Home | Mirror | Search

7. ip tunnel

ipip 是IP隧道模組

過程 38.1. ip tunnel IP隧道配置步驟

  1. server 1

    modprobe ipip
    ip tunnel add mytun mode ipip remote 220.201.35.11 local 211.100.37.167 ttl 255
    ifconfig mytun 10.42.1.1
    route add -net 10.42.1.0/24 dev mytun
    				
  2. server 2

    modprobe ipip
    ip tunnel add mytun mode ipip remote 211.100.37.167 local 220.201.35.11 ttl 255
    ifconfig mytun 10.42.1.2
    route add -net 10.42.1.0/24 dev mytun
    				
  3. nat

    /sbin/iptables -t nat -A POSTROUTING -s 10.42.1.0/24 -j MASQUERADE
    /sbin/iptables -t nat -A POSTROUTING -s 211.100.37.0/24 -j MASQUERADE
    				

刪除路由表

route del -net 10.42.1.0/24 dev mytun
		

修改IP隧道的IP

ifconfig mytun 10.10.10.220
route add -net 10.10.10.0/24 dev mytun
		

ip 偽裝

/sbin/iptables -t nat -A POSTROUTING -s 10.10.10.0/24 -j MASQUERADE
		
comments powered by Disqus