• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 613
  • Last Modified:

rhel gateway, dhcp and NAT

sorry if you find the question boring but i read countless web pages and even here i didn't find a clear answer, i tried many tutorials but still cant even ping clients from server and vice versa.
my question is how to setup a gateway, dhcp and nat server

my system is rhel 5.1 server installed on vmware esxi with 2 physical nic, eth0 for internet and eth1 for internal network
internet connected to siemens router then connected to eth0 nic and then from eth1 to netear switch...
ip of the router is mask

big thx guys.
  • 5
  • 4
1 Solution
Kerem ERSOYPresidentCommented:

will you post the output of your ifconfig  and netstat -rn here ?

Kerem ERSOYPresidentCommented:
First of all since this is a gateway you need to enable routing through interfaces with this command:

echo 1 > /proc/sys/net/ipv4/ip_forward

Tm make it permanent add this line to your /etc/sysconfig/network or modify if it exists::

FORWARD_IPV4=true   (it is false by default)
jusbugAuthor Commented:
i reset every thing to start fresh except ip forwarding is enabled


eth0      Link encap:Ethernet  HWaddr 00:0C:29:DA:79:54  
          inet addr:  Bcast:  Mask:
          inet6 addr: fe80::20c:29ff:feda:7954/64 Scope:Link
          RX packets:86 errors:0 dropped:0 overruns:0 frame:0
          TX packets:62 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:10728 (10.4 KiB)  TX bytes:9339 (9.1 KiB)
          Interrupt:59 Base address:0x2024

eth1      Link encap:Ethernet  HWaddr 00:0C:29:DA:79:5E  
          inet addr:  Bcast:  Mask:
          inet6 addr: fe80::20c:29ff:feda:795e/64 Scope:Link
          RX packets:70 errors:0 dropped:0 overruns:0 frame:0
          TX packets:59 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:9789 (9.5 KiB)  TX bytes:9174 (8.9 KiB)
          Interrupt:67 Base address:0x20a4

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

netstat -rn:

Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface   U         0 0          0 eth0   U         0 0          0 eth1     U         0 0          0 eth1         UG        0 0          0 eth0

Train for your Pen Testing Engineer Certification

Enroll today in this bundle of courses to gain experience in the logistics of pen testing, Linux fundamentals, vulnerability assessments, detecting live systems, and more! This series, valued at $3,000, is free for Premium members, Team Accounts, and Qualified Experts.

Kerem ERSOYPresidentCommented:
Ok can you ping the ? If not it might mean that you have connectivity issues)

Your eth1 settings are incorrect !! Both eth0 and eth1 at the same subnet.  ( You need to change eth1 to some different subnet such as In the current configuration it is not possible to route packets between interface since both are at the same subnet.

jusbugAuthor Commented:
i think i got the picture (hopefully)

because both nic were in the same subnet what ever i tried doesn't work, i will do everything over again i'll let you know

big big thanks m8
jusbugAuthor Commented:
btw i cant ping
Kerem ERSOYPresidentCommented:
You're welcome

I guess your siemens does to Intrnatet-to-public address mapping. So you wont need to do NAT at the RHEL gateway. But you need to add extra routing info to Siemens in theis case such as it will know how to toure packages.

route add 192.168.128

The layout should be

                         eth1 >
Siemens ---------------------   RHEL -------------------- Switch------- intranet PC's            < eth0                        

If you want you can run DNS over rhel and assign them addresses too. But if you ned to run DHCP over the RHEL don't forget to bind DHCP only to eth1 and not eth0. Also since all addresses at 192.168.1.x segment are assigned manually yo can safely disable the DHCP server over the Siemens.

If you can't ping try to switch ethernet ports may be you've cabled in eth1 to eth0 and vice versa. If you still can not ping then check your VMWare settings.

Kerem ERSOYPresidentCommented:

route add 192.168.128

should read

route add
jusbugAuthor Commented:
i find out that the probleme was with vmware, but still not only i learned from the answers but it helped me to figure out where the probleme was.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now