OpenVZ Forum


Home » General » Support » *SOLVED* nat not working
*SOLVED* nat not working [message #10260] Wed, 14 February 2007 01:33
nonamesir is currently offline  nonamesir
Messages: 4
Registered: February 2007
Junior Member
edit: problem solved, turns out the vm's ip settings were messed up and i had the ips the other way around for the NAT rule

I'm trying to get the VE to communicate with the outside world. here is the vm's info:

oot@vm101:~# ifconfig
lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

venet0    Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
          inet addr:127.0.0.1  P-t-P:127.0.0.1  Bcast:0.0.0.0  Mask:255.255.255.255
          UP BROADCAST POINTOPOINT RUNNING NOARP  MTU:1500  Metric:1
          RX packets:404 errors:0 dropped:0 overruns:0 frame:0
          TX packets:318 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:33172 (32.3 KiB)  TX bytes:44637 (43.5 KiB)

venet0:0  Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
          inet addr:192.168.2.10  P-t-P:192.168.2.10  Bcast:0.0.0.0  Mask:255.255.255.255
          UP BROADCAST POINTOPOINT RUNNING NOARP  MTU:1500  Metric:1

root@vm101:~# route -N
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.0.2.1       0.0.0.0         255.255.255.255 UH    0      0        0 venet0
0.0.0.0         192.0.2.1       0.0.0.0         UG    0      0        0 venet0



And, on the Host's side, the information is:
[root@MyTestBox ~]# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:0C:29:91:38:FB
          inet addr:192.168.0.127  Bcast:192.168.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:53056 errors:0 dropped:0 overruns:0 frame:0
          TX packets:34999 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:68221259 (65.0 MiB)  TX bytes:3327550 (3.1 MiB)
          Interrupt:17 Base address:0x1400

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

venet0    Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
          UP BROADCAST POINTOPOINT RUNNING NOARP  MTU:1500  Metric:1
          RX packets:366 errors:0 dropped:0 overruns:0 frame:0
          TX packets:460 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:50701 (49.5 KiB)  TX bytes:36884 (36.0 KiB)



i research the docs and ran this on the host

[root@MyTestBox ~]# iptables -t nat -A POSTROUTING -s 192.168.0.127 -o eth0 -j SNAT --to 192.168.2.10

[root@MyTestBox ~]# iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination




The VE can ping the host machine, the host machine can ping google, however the VE can't ping any outside IPs or domain names.

[Updated on: Wed, 14 February 2007 07:18] by Moderator

Report message to a moderator

 
Read Message
Previous Topic: VPS -> HN having problems communicating
Next Topic: strato server with second IP Adress
Goto Forum:
  


Current Time: Fri Aug 09 02:13:53 GMT 2024

Total time taken to generate the page: 0.02849 seconds