#### [[返回文档目录]](../index.html) [[查看原始页]](../content/%E4%BD%BF%E7%94%A8%20ip%20tunnel%20%E5%BB%BA%E7%AB%8B%20VPN%20%C2%BB%20Technical%20Blog.html) # 使用 ip tunnel 建立 VPN » Technical Blog 在国内的上网环境下,使用 VPN 的好处显而易见。 有一种 ip tunnel 模式叫 ipip,是我见过搭建 VPN 最简单的方式,但是它有一个前提,即作为网关的两台机器都要有公网 IP,而且支持 ipip 数据包收发。 达成这两个条件以后,我们就可以花两分钟时间快速搭建 VPN 。 假如 A 网络的网关机器公网 IP 为 207.47.0.1,B 网络的网关机器公网 IP 为 207.47.34.10。然后设定目标 VPN 私网网段为 192.168.10.0/24。 我们首先在 A 机器上配置,以 Debian 为例,编辑 /etc/network/interfaces 文件,添加一个虚拟网络设备 sit0,具体配置如下: [?](http://dola.xinfan.org/?p=252#) <table border="0" cellpadding="0" cellspacing="0" style="display: table; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: 15.296875px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; height: 45px; margin: 0px; padding: 0px; text-align: left; text-decoration: initial; width: 693px;"><tbody style="display: table-row-group; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: 15.296875px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; height: 45px; margin: 0px; padding: 0px; text-align: left; text-decoration: initial; width: 693px;"><tr style="display: table-row; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: 15.296875px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; height: 45px; margin: 0px; padding: 0px; text-align: left; text-decoration: initial; width: 693px;"><td style="border: 0px none rgb(120, 120, 120); color: rgb(120, 120, 120); display: table-cell; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: 15.296875px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; height: 45px; margin: 0px; outline: rgb(120, 120, 120) none 0px; padding: 0px; text-align: left; text-decoration: initial; width: 32px;"><div style="background-image: none; background-attachment: scroll; background-origin: padding-box; background-clip: border-box; background-color: rgb(255, 255, 255); background-size: auto; color: rgb(120, 120, 120); display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: 15.296875px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; height: 15px; margin: 0px; outline: rgb(120, 120, 120) none 0px; padding: 0px 6.953125px 0px 13.90625px; text-align: right; text-decoration: initial; white-space: pre; width: 8.140625px; background-position: 0% 0%; background-repeat: repeat repeat;">1</div><div style="background-image: none; background-attachment: scroll; background-origin: padding-box; background-clip: border-box; background-color: rgb(255, 255, 255); background-size: auto; color: rgb(120, 120, 120); display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: 15.296875px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; height: 15px; margin: 0px; outline: rgb(120, 120, 120) none 0px; padding: 0px 6.953125px 0px 13.90625px; text-align: right; text-decoration: initial; white-space: pre; width: 8.140625px; background-position: 0% 0%; background-repeat: repeat repeat;">2</div><div style="background-image: none; background-attachment: scroll; background-origin: padding-box; background-clip: border-box; background-color: rgb(255, 255, 255); background-size: auto; color: rgb(120, 120, 120); display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: 15.296875px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; height: 15px; margin: 0px; outline: rgb(120, 120, 120) none 0px; padding: 0px 6.953125px 0px 13.90625px; text-align: right; text-decoration: initial; white-space: pre; width: 8.140625px; background-position: 0% 0%; background-repeat: repeat repeat;">3</div></td><td style="display: table-cell; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: 15.296875px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; height: 45px; margin: 0px; padding: 0px; text-align: left; text-decoration: initial; width: 661px;"><div style="display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: 15.296875px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; height: 45px; margin: 0px; padding: 0px; position: relative; text-align: left; text-decoration: initial; width: 661px;"><div style="background-image: none; background-attachment: scroll; background-origin: padding-box; background-clip: border-box; background-color: rgb(255, 255, 255); background-size: auto; display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: 15.296875px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; height: 15px; margin: 0px; padding: 0px 13.90625px; text-align: left; text-decoration: initial; white-space: pre; width: 633.1875px; background-position: 0% 0%; background-repeat: repeat repeat;"><code style="display: inline; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: 15.296875px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; margin: 0px; padding: 0px; text-align: left; text-decoration: initial; white-space: pre;">ip tunnel add iptun0 mode ipip remote 207.47.34.10 local 210.47.0.1</code></div><div style="background-image: none; background-attachment: scroll; background-origin: padding-box; background-clip: border-box; background-color: rgb(255, 255, 255); background-size: auto; display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: 15.296875px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; height: 15px; margin: 0px; padding: 0px 13.90625px; text-align: left; text-decoration: initial; white-space: pre; width: 633.1875px; background-position: 0% 0%; background-repeat: repeat repeat;"><code style="display: inline; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: 15.296875px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; margin: 0px; padding: 0px; text-align: left; text-decoration: initial; white-space: pre;">ip link set iptun0 up</code></div><div style="background-image: none; background-attachment: scroll; background-origin: padding-box; background-clip: border-box; background-color: rgb(255, 255, 255); background-size: auto; display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: 15.296875px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; height: 15px; margin: 0px; padding: 0px 13.90625px; text-align: left; text-decoration: initial; white-space: pre; width: 633.1875px; background-position: 0% 0%; background-repeat: repeat repeat;"><code style="display: inline; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: 15.296875px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; margin: 0px; padding: 0px; text-align: left; text-decoration: initial; white-space: pre;">ip addr add 192.168.10.11/24 dev iptun0</code></div></div></td></tr></tbody></table> 同样在 B 机器上配置,编辑 /etc/network/interfaces 文件,添加一个虚拟网络设备 sit0,具体配置如下: [?](http://dola.xinfan.org/?p=252#) <table border="0" cellpadding="0" cellspacing="0" style="display: table; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: 15.296875px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; height: 45px; margin: 0px; padding: 0px; text-align: left; text-decoration: initial; width: 693px;"><tbody style="display: table-row-group; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: 15.296875px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; height: 45px; margin: 0px; padding: 0px; text-align: left; text-decoration: initial; width: 693px;"><tr style="display: table-row; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: 15.296875px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; height: 45px; margin: 0px; padding: 0px; text-align: left; text-decoration: initial; width: 693px;"><td style="border: 0px none rgb(120, 120, 120); color: rgb(120, 120, 120); display: table-cell; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: 15.296875px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; height: 45px; margin: 0px; outline: rgb(120, 120, 120) none 0px; padding: 0px; text-align: left; text-decoration: initial; width: 32px;"><div style="background-image: none; background-attachment: scroll; background-origin: padding-box; background-clip: border-box; background-color: rgb(255, 255, 255); background-size: auto; color: rgb(120, 120, 120); display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: 15.296875px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; height: 15px; margin: 0px; outline: rgb(120, 120, 120) none 0px; padding: 0px 6.953125px 0px 13.90625px; text-align: right; text-decoration: initial; white-space: pre; width: 8.140625px; background-position: 0% 0%; background-repeat: repeat repeat;">1</div><div style="background-image: none; background-attachment: scroll; background-origin: padding-box; background-clip: border-box; background-color: rgb(255, 255, 255); background-size: auto; color: rgb(120, 120, 120); display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: 15.296875px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; height: 15px; margin: 0px; outline: rgb(120, 120, 120) none 0px; padding: 0px 6.953125px 0px 13.90625px; text-align: right; text-decoration: initial; white-space: pre; width: 8.140625px; background-position: 0% 0%; background-repeat: repeat repeat;">2</div><div style="background-image: none; background-attachment: scroll; background-origin: padding-box; background-clip: border-box; background-color: rgb(255, 255, 255); background-size: auto; color: rgb(120, 120, 120); display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: 15.296875px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; height: 15px; margin: 0px; outline: rgb(120, 120, 120) none 0px; padding: 0px 6.953125px 0px 13.90625px; text-align: right; text-decoration: initial; white-space: pre; width: 8.140625px; background-position: 0% 0%; background-repeat: repeat repeat;">3</div></td><td style="display: table-cell; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: 15.296875px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; height: 45px; margin: 0px; padding: 0px; text-align: left; text-decoration: initial; width: 661px;"><div style="display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: 15.296875px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; height: 45px; margin: 0px; padding: 0px; position: relative; text-align: left; text-decoration: initial; width: 661px;"><div style="background-image: none; background-attachment: scroll; background-origin: padding-box; background-clip: border-box; background-color: rgb(255, 255, 255); background-size: auto; display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: 15.296875px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; height: 15px; margin: 0px; padding: 0px 13.90625px; text-align: left; text-decoration: initial; white-space: pre; width: 633.1875px; background-position: 0% 0%; background-repeat: repeat repeat;"><code style="display: inline; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: 15.296875px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; margin: 0px; padding: 0px; text-align: left; text-decoration: initial; white-space: pre;">ip tunnel add iptun0 mode ipip remote 210.47.0.1 local 207.47.34.10</code></div><div style="background-image: none; background-attachment: scroll; background-origin: padding-box; background-clip: border-box; background-color: rgb(255, 255, 255); background-size: auto; display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: 15.296875px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; height: 15px; margin: 0px; padding: 0px 13.90625px; text-align: left; text-decoration: initial; white-space: pre; width: 633.1875px; background-position: 0% 0%; background-repeat: repeat repeat;"><code style="display: inline; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: 15.296875px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; margin: 0px; padding: 0px; text-align: left; text-decoration: initial; white-space: pre;">ip link set iptun0 up</code></div><div style="background-image: none; background-attachment: scroll; background-origin: padding-box; background-clip: border-box; background-color: rgb(255, 255, 255); background-size: auto; display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: 15.296875px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; height: 15px; margin: 0px; padding: 0px 13.90625px; text-align: left; text-decoration: initial; white-space: pre; width: 633.1875px; background-position: 0% 0%; background-repeat: repeat repeat;"><code style="display: inline; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: 15.296875px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; margin: 0px; padding: 0px; text-align: left; text-decoration: initial; white-space: pre;">ip addr add 192.168.10.12/24 dev iptun0</code></div></div></td></tr></tbody></table> 配置完成后分别重启两台机器的网络: [?](http://dola.xinfan.org/?p=252#) <table border="0" cellpadding="0" cellspacing="0" style="display: table; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: 15.296875px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; height: 15px; margin: 0px; padding: 0px; text-align: left; text-decoration: initial; width: 693px;"><tbody style="display: table-row-group; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: 15.296875px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; height: 15px; margin: 0px; padding: 0px; text-align: left; text-decoration: initial; width: 693px;"><tr style="display: table-row; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: 15.296875px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; height: 15px; margin: 0px; padding: 0px; text-align: left; text-decoration: initial; width: 693px;"><td style="border: 0px none rgb(120, 120, 120); color: rgb(120, 120, 120); display: table-cell; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: 15.296875px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; height: 15px; margin: 0px; outline: rgb(120, 120, 120) none 0px; padding: 0px; text-align: left; text-decoration: initial; width: 32px;"><div style="background-image: none; background-attachment: scroll; background-origin: padding-box; background-clip: border-box; background-color: rgb(255, 255, 255); background-size: auto; color: rgb(120, 120, 120); display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: 15.296875px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; height: 15px; margin: 0px; outline: rgb(120, 120, 120) none 0px; padding: 0px 6.953125px 0px 13.90625px; text-align: right; text-decoration: initial; white-space: pre; width: 8.140625px; background-position: 0% 0%; background-repeat: repeat repeat;">1</div></td><td style="display: table-cell; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: 15.296875px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; height: 15px; margin: 0px; padding: 0px; text-align: left; text-decoration: initial; width: 661px;"><div style="display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: 15.296875px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; height: 15px; margin: 0px; padding: 0px; position: relative; text-align: left; text-decoration: initial; width: 661px;"><div style="background-image: none; background-attachment: scroll; background-origin: padding-box; background-clip: border-box; background-color: rgb(255, 255, 255); background-size: auto; display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: 15.296875px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; height: 15px; margin: 0px; padding: 0px 13.90625px; text-align: left; text-decoration: initial; white-space: pre; width: 633.1875px; background-position: 0% 0%; background-repeat: repeat repeat;"><code style="border: 0px none rgb(63, 95, 191); color: rgb(63, 95, 191); display: inline; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: 15.296875px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; margin: 0px; outline: rgb(63, 95, 191) none 0px; padding: 0px; text-align: left; text-decoration: initial; white-space: pre;"># /etc/init.d/networking restart</code></div></div></td></tr></tbody></table> 正常情况下这样两台机器就处在同一个私网网段中了,可以用 /sbin/ifconfig 看到 iptun0 设备。 如果 A 机器要能过 B 机器上网,只要将 A 机器的路由指向 B机器,同时打开 B 机器的 NAT 和 IP 地址转发: 在 A 上执行: [?](http://dola.xinfan.org/?p=252#) <table border="0" cellpadding="0" cellspacing="0" style="display: table; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: 15.296875px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; height: 15px; margin: 0px; padding: 0px; text-align: left; text-decoration: initial; width: 693px;"><tbody style="display: table-row-group; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: 15.296875px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; height: 15px; margin: 0px; padding: 0px; text-align: left; text-decoration: initial; width: 693px;"><tr style="display: table-row; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: 15.296875px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; height: 15px; margin: 0px; padding: 0px; text-align: left; text-decoration: initial; width: 693px;"><td style="border: 0px none rgb(120, 120, 120); color: rgb(120, 120, 120); display: table-cell; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: 15.296875px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; height: 15px; margin: 0px; outline: rgb(120, 120, 120) none 0px; padding: 0px; text-align: left; text-decoration: initial; width: 32px;"><div style="background-image: none; background-attachment: scroll; background-origin: padding-box; background-clip: border-box; background-color: rgb(255, 255, 255); background-size: auto; color: rgb(120, 120, 120); display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: 15.296875px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; height: 15px; margin: 0px; outline: rgb(120, 120, 120) none 0px; padding: 0px 6.953125px 0px 13.90625px; text-align: right; text-decoration: initial; white-space: pre; width: 8.140625px; background-position: 0% 0%; background-repeat: repeat repeat;">1</div></td><td style="display: table-cell; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: 15.296875px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; height: 15px; margin: 0px; padding: 0px; text-align: left; text-decoration: initial; width: 661px;"><div style="display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: 15.296875px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; height: 15px; margin: 0px; padding: 0px; position: relative; text-align: left; text-decoration: initial; width: 661px;"><div style="background-image: none; background-attachment: scroll; background-origin: padding-box; background-clip: border-box; background-color: rgb(255, 255, 255); background-size: auto; display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: 15.296875px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; height: 15px; margin: 0px; padding: 0px 13.90625px; text-align: left; text-decoration: initial; white-space: pre; width: 633.1875px; background-position: 0% 0%; background-repeat: repeat repeat;"><code style="display: inline; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: 15.296875px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; margin: 0px; padding: 0px; text-align: left; text-decoration: initial; white-space: pre;"># ip route replace default via 192.168.10.12 dev iptun0</code></div></div></td></tr></tbody></table> 在 B 上执行: [?](http://dola.xinfan.org/?p=252#) <table border="0" cellpadding="0" cellspacing="0" style="display: table; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: 15.296875px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; height: 45px; margin: 0px; padding: 0px; text-align: left; text-decoration: initial; width: 693px;"><tbody style="display: table-row-group; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: 15.296875px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; height: 45px; margin: 0px; padding: 0px; text-align: left; text-decoration: initial; width: 693px;"><tr style="display: table-row; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: 15.296875px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; height: 45px; margin: 0px; padding: 0px; text-align: left; text-decoration: initial; width: 693px;"><td style="border: 0px none rgb(120, 120, 120); color: rgb(120, 120, 120); display: table-cell; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: 15.296875px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; height: 45px; margin: 0px; outline: rgb(120, 120, 120) none 0px; padding: 0px; text-align: left; text-decoration: initial; width: 32px;"><div style="background-image: none; background-attachment: scroll; background-origin: padding-box; background-clip: border-box; background-color: rgb(255, 255, 255); background-size: auto; color: rgb(120, 120, 120); display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: 15.296875px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; height: 15px; margin: 0px; outline: rgb(120, 120, 120) none 0px; padding: 0px 6.953125px 0px 13.90625px; text-align: right; text-decoration: initial; white-space: pre; width: 8.140625px; background-position: 0% 0%; background-repeat: repeat repeat;">1</div><div style="background-image: none; background-attachment: scroll; background-origin: padding-box; background-clip: border-box; background-color: rgb(255, 255, 255); background-size: auto; color: rgb(120, 120, 120); display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: 15.296875px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; height: 15px; margin: 0px; outline: rgb(120, 120, 120) none 0px; padding: 0px 6.953125px 0px 13.90625px; text-align: right; text-decoration: initial; white-space: pre; width: 8.140625px; background-position: 0% 0%; background-repeat: repeat repeat;">2</div><div style="background-image: none; background-attachment: scroll; background-origin: padding-box; background-clip: border-box; background-color: rgb(255, 255, 255); background-size: auto; color: rgb(120, 120, 120); display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: 15.296875px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; height: 15px; margin: 0px; outline: rgb(120, 120, 120) none 0px; padding: 0px 6.953125px 0px 13.90625px; text-align: right; text-decoration: initial; white-space: pre; width: 8.140625px; background-position: 0% 0%; background-repeat: repeat repeat;">3</div></td><td style="display: table-cell; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: 15.296875px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; height: 45px; margin: 0px; padding: 0px; text-align: left; text-decoration: initial; width: 661px;"><div style="display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: 15.296875px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; height: 45px; margin: 0px; padding: 0px; position: relative; text-align: left; text-decoration: initial; width: 661px;"><div style="background-image: none; background-attachment: scroll; background-origin: padding-box; background-clip: border-box; background-color: rgb(255, 255, 255); background-size: auto; display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: 15.296875px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; height: 15px; margin: 0px; padding: 0px 13.90625px; text-align: left; text-decoration: initial; white-space: pre; width: 633.1875px; background-position: 0% 0%; background-repeat: repeat repeat;"><code style="border: 0px none rgb(63, 95, 191); color: rgb(63, 95, 191); display: inline; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: 15.296875px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; margin: 0px; outline: rgb(63, 95, 191) none 0px; padding: 0px; text-align: left; text-decoration: initial; white-space: pre;"># echo 1 &gt; /proc/sys/net/ipv4/ip_forward</code></div><div style="background-image: none; background-attachment: scroll; background-origin: padding-box; background-clip: border-box; background-color: rgb(255, 255, 255); background-size: auto; display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: 15.296875px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; height: 15px; margin: 0px; padding: 0px 13.90625px; text-align: left; text-decoration: initial; white-space: pre; width: 633.1875px; background-position: 0% 0%; background-repeat: repeat repeat;"><code style="border: 0px none rgb(63, 95, 191); color: rgb(63, 95, 191); display: inline; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: 15.296875px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; margin: 0px; outline: rgb(63, 95, 191) none 0px; padding: 0px; text-align: left; text-decoration: initial; white-space: pre;"># iptables -t nat -A POSTROUTING -m conntrack --ctstate DNAT -j MASQUERADE </code></div><div style="background-image: none; background-attachment: scroll; background-origin: padding-box; background-clip: border-box; background-color: rgb(255, 255, 255); background-size: auto; display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: 15.296875px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; height: 15px; margin: 0px; padding: 0px 13.90625px; text-align: left; text-decoration: initial; white-space: pre; width: 633.1875px; background-position: 0% 0%; background-repeat: repeat repeat;"><code style="border: 0px none rgb(63, 95, 191); color: rgb(63, 95, 191); display: inline; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: 15.296875px; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace; margin: 0px; outline: rgb(63, 95, 191) none 0px; padding: 0px; text-align: left; text-decoration: initial; white-space: pre;"># iptables -t nat -A POSTROUTING -s 192.168.10.0/24 -o eth0 -j MASQUERADE</code></div></div></td></tr></tbody></table>