3

I'm trying to forward all traffic from tun0 to eth0,below is my interfaces:

 eth0      Link encap:Ethernet  HWaddr 12:57:6e:6a:74:85
      inet addr:172.31.32.133  Bcast:172.31.47.255  Mask:255.255.240.0

tun0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-
      inet addr:192.168.77.1  P-t-P:192.168.77.2  Mask:255.255.255.255

The commands I used are:

sudo bash -c 'echo 1 > /proc/sys/net/ipv4/ip_forward'
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
sudo iptables -A FORWARD -i eth0 -o tun0 -m state --state  RELATED,ESTABLISHED -j ACCEPT
sudo iptables -A FORWARD -i tun0 -o eth0 -j ACCEPT

I tried in two machines, but all failed, can't get any response from ping.

$ ping -I tun0 8.8.8.8
muru
  • 197,895
  • 55
  • 485
  • 740
Raymond
  • 31
  • Please don't post screenshots of text. Just copy the text here. And unless you're root, sudo echo 1 > ... will fail: http://askubuntu.com/q/230476/158442 – muru Dec 30 '15 at 10:31

0 Answers0