close

1. 在一個interface 上綁定多個IP
# vim /etc/sysconfig/network-scripts/ifcfg-eth0:0
------------------------------------------------------------
DEVICE=eth0:0
BOOTPROTO=none
IPADDR=140.140.140.1
NETMASK=255.255.255.0
ONBOOT=yes
------------------------------------------------------------

# service network restart

2. 開啟IP Forward的功能
# vim /etc/sysctl.conf
------------------------------------------------------------
......
net.ipv4.ip_forward = 1
net.ipv4.tcp_keepalive_time = 86400

......
------------------------------------------------------------

# sysctl -p

3. 加入iptables的NAT policy
# vim /etc/sysconfig/iptables
------------------------------------------------------------
......
*nat
:PREROUTING ACCEPT [417:47118]
:POSTROUTING ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]

# NAT Policy
-A POSTROUTING -s 192.168.1.1 -o eth0 -j SNAT --to-source 140.140.140.1
-A PREROUTING -d 140.140.140.1 -i eth0 -j DNAT --to-destination 192.168.1.1


COMMIT
......
------------------------------------------------------------

# service iptables restart

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 dreamtails 的頭像
    dreamtails

    雜七雜八的小筆記!

    dreamtails 發表在 痞客邦 留言(0) 人氣()