LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 07-25-2008, 07:11 AM   #1
afonic
LQ Newbie
 
Registered: Sep 2007
Posts: 2

Rep: Reputation: 0
Using iptables to route an external IP to Vmware


Hello,

I am using CentOS 5 with Vmware Server in order to run Windows2k3.

What I am trying to do is associate the windows virtual machine with just one of the many IP addresses that I have setup in CentOS. Bridged networking is not an option so I have to use NAT or Host-Only.

ifconfig -a:

Code:
eth0      Link encap:Ethernet  HWaddr 00:E0:4C:4F:5A:D1
          inet addr:85.10.192.172  Bcast:85.10.192.191  Mask:255.255.255.224
          inet6 addr: fe80::2e0:4cff:fe4f:5ad1/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1230673 errors:1 dropped:0 overruns:0 frame:0
          TX packets:1459180 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:373669391 (356.3 MiB)  TX bytes:972460494 (927.4 MiB)
          Interrupt:185 Base address:0x2000

eth0:2    Link encap:Ethernet  HWaddr 00:E0:4C:4F:5A:D1
          inet addr:88.198.75.114  Bcast:88.198.75.119  Mask:255.255.255.248
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          Interrupt:185 Base address:0x2000

eth0:3    Link encap:Ethernet  HWaddr 00:E0:4C:4F:5A:D1
          inet addr:88.198.75.115  Bcast:88.198.75.119  Mask:255.255.255.248
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          Interrupt:185 Base address:0x2000

eth0:4    Link encap:Ethernet  HWaddr 00:E0:4C:4F:5A:D1
          inet addr:88.198.75.116  Bcast:88.198.75.119  Mask:255.255.255.248
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          Interrupt:185 Base address:0x2000

eth0:5    Link encap:Ethernet  HWaddr 00:E0:4C:4F:5A:D1
          inet addr:88.198.75.118  Bcast:88.198.75.119  Mask:255.255.255.248
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          Interrupt:185 Base address:0x2000

eth0:6    Link encap:Ethernet  HWaddr 00:E0:4C:4F:5A:D1
          inet addr:88.198.75.117  Bcast:88.198.75.119  Mask:255.255.255.248
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          Interrupt:185 Base address:0x2000

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:333047 errors:0 dropped:0 overruns:0 frame:0
          TX packets:333047 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:62068125 (59.1 MiB)  TX bytes:62068125 (59.1 MiB)

sit0      Link encap:IPv6-in-IPv4
          NOARP  MTU:1480  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)

vmnet0    Link encap:Ethernet  HWaddr 00:50:56:C0:00:00
          inet addr:192.168.4.1  Bcast:192.168.4.255  Mask:255.255.255.0
          inet6 addr: fe80::250:56ff:fec0:0/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:248 errors:0 dropped:0 overruns:0 frame:0
          TX packets:47 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)
And I am trying to do something like this:

Code:
/sbin/iptables -t nat -A PREROUTING -d  88.198.75.117 -j DNAT --to 192.168.4.101

/sbin/iptables -t nat -A POSTROUTING -s 192.168.4.101 -j SNAT --to  88.198.75.117
But even though all my tips suggest it should work, Vmware still uses the default IP of eth0 (85.10.192.172) when connected to the internet when I use NAT. In the other hand when using Host-only networking in Vmware I have no internet at all (even though my host suggest I should) All I need is for the outside world to see that box as 88.198.75.117. Note that I have enabled ip forward in /etc/sysctl.conf and tried both host only and NAT modes.

Any tips would be greatly appreciated as I am just starting with iptables and I am really stuck for a few days now.

Thanks.
 
Old 07-25-2008, 07:11 AM   #2
afonic
LQ Newbie
 
Registered: Sep 2007
Posts: 2

Original Poster
Rep: Reputation: 0
Here is a relevant article in my host's wiki: (translated from German) http://66.102.9.104/translate_c?hl=e...YqsRNF-2nuDmDg
Original version because Google alters the iptables command: http://wiki.hetzner.de/index.php/VMw..._%C3%BCber_NAT

(sorry for the double post, I couldn't post links before)

Last edited by afonic; 07-25-2008 at 07:34 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
WinXP x64 route path to VPN through VMware-> linux LandRover Linux - Networking 10 01-29-2009 09:36 AM
iptables or route whoober Linux - Security 6 03-23-2008 08:17 AM
Some help with iptables and iproute2 or route Histamine Linux - Networking 1 11-28-2007 02:53 PM
iptables -L -v and route lag tgo Linux - Networking 4 07-24-2006 07:12 PM
STATIC Route using IPTables Milkman00 Linux - Networking 3 03-06-2003 07:47 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 06:23 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration