eth1에 추가 IP를 셋팅한다.

cat << EOF > /etc/sysconfig/network-scripts/ifcfg-eth1:1

DEVICE=eth1:1

GATEWAY=169.56.100.1

IPADDR=169.56.100.100

NETMASK=255.255.255.0

ONBOOT=yes

EOF


#Full NAT 설정

systemctl start firewalld

systemctl enable firewalld

systemctl restart NetworkManager


echo "net.ipv4.ip_forward = 1" > /etc/sysctl.d/ip_forward.conf

sysctl -p /etc/sysctl.d/ip_forward.conf



#Full NAT Setting

function fullnat() {

  local LOCAL_DEV=$1

  local LOCAL_IP=$2

  local DEST_DEV=$3

  local DEST_IP=$4

  firewall-cmd --direct --permanent --add-rule ipv4 nat PREROUTING 1 -i ${LOCAL_DEV} -d ${LOCAL_IP} -j DNAT --to-destination ${DEST_IP}

  firewall-cmd --direct --permanent --add-rule ipv4 nat POSTROUTING 0 -o ${DEST_DEV} -s ${DEST_IP} -j SNAT --to-source ${LOCAL_IP}

  firewall-cmd --direct --permanent --add-rule ipv4 filter FORWARD 0 -s ${LOCAL_IP} -j ACCEPT

  firewall-cmd --direct --permanent --add-rule ipv4 filter FORWARD 0 -d ${DEST_IP} -j ACCEPT

}


#Public -> Private

fullnat eth1 169.56.100.100 eth0 10.10.5.5

#Public -> Public 

fullnat eth1 169.56.100.100 eth1 13.125.100.100

#Private -> Private

fullnat eth0 10.100.10.10 eth0 10.10.5.5

#Private -> Public

fullnat eth0 10.10.5.5 eth1 169.56.100.100


#Bonded Private -> Private

fullnat bond0 10.100.10.10 bond0 10.10.5.5



'OS > Linux' 카테고리의 다른 글

CENTOS 7 , firewall-cmd Port forwarding  (0) 2019.04.05
nodejs 설치 in CentOS  (0) 2019.03.21
pdnsd로 DNS Proxy 설정하기  (0) 2018.11.05
firewalld 설정  (0) 2018.11.04
SAMBA 설치 at CentOS 7  (0) 2018.08.29

+ Recent posts