1

I have just setup a machine which has two NICs, one for private network and the other one for public network which has a real IP assigned to it.

DEVICE=eth0
HWADDR=XXX
TYPE=Ethernet
UUID=XXX
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=none
IPADDR=172.26.111.131
NETMASK=255.255.255.128
GATEWAY=172.26.111.129

Configuration of eth1 for public network as follows;

DEVICE=eth1
HWADDR=XXX
TYPE=Ethernet
UUID=XXX
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=none
IPADDR=PUBLIC_IP
NETMASK=255.255.255.248
GATEWAY=PUBLIC_GATEWAY


Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         PUBLIC_GATEWAY   0.0.0.0         UG    0      0        0 eth1
PUBLIC_NID      *               255.255.255.248 U     0      0        0 eth1
link-local      *               255.255.0.0     U     1002   0        0 eth0
link-local      *               255.255.0.0     U     1004   0        0 eth1
172.26.111.128  *               255.255.255.128 U     0      0        0 eth0

I am sure this is quite easy to achieve. I have searched about this, but somehow could not get this working. The machine still tries to route private IPs via public gateway.

I would appreciate any ideas on this. Where I am wrong at?

I am just trying to be able to access 172.26.111.128/25 via eth0.

closed as off-topic by slm Jul 22 '18 at 0:48

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions describing a problem that can't be reproduced and seemingly went away on its own (or went away when a typo was fixed) are off-topic as they are unlikely to help future readers." – slm
If this question can be reworded to fit the rules in the help center, please edit the question.

  • And what IP address are you coming from? – tink Apr 30 '13 at 0:55
  • which ip you are trying to access in lan provide that also.. – Rahul Patil Apr 30 '13 at 3:01
  • You appear to have given your NIC the network address. That ip isn't valid for a host. – jordanm Apr 30 '13 at 3:29
  • 172.26.111.131 is the IP address that I want to use for this host on that private network. I am trying to access 172.26.111.130, however, I even cannot ping the gateway itself with this current setup. – compixtr Apr 30 '13 at 8:45
0

My setup

I've setup an alias for eth0 so that it actually possesses 2 IP addresses, 192.168.1.6 & 192.168.1.254.

I do something like this locally:

ifconfig eth1:0 192.168.1.254
route add -host 192.168.1.254 dev eth1:0

This gives me a routing table like this:

$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.1.254   0.0.0.0         255.255.255.255 UH    0      0        0 eth1
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth1
ISP_NETWORK     0.0.0.0         255.255.240.0   U     0      0        0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U     0      0        0 eth1
0.0.0.0         ISP_GATEWAY     0.0.0.0         UG    0      0        0 eth0

This gives me a route like this:

192.168.1.254   0.0.0.0         255.255.255.255 UH    0      0        0 eth1

References

  • Hi slm, thank but I indeed am trying to be able to access 172.26.111.128/25 via eth0 while 172.26.111.131(within same network) should be assigned to eth0. – compixtr Apr 30 '13 at 9:03
  • See my updates. – slm Apr 30 '13 at 11:48
  • Well, to be honest, that did not make much sense to me - 192.168.1.254 -> 0.0.0.0 ? is this reasonable? does not this mean that the stuff destinate that IP will be routed via ISP's gateway? – compixtr Apr 30 '13 at 12:05
0

Well, it was our fault guys. I was trying to ping a host which indeed does not exist hence I was thinking as if the network was not routing properly. Thanks for all your messages and helps!

Not the answer you're looking for? Browse other questions tagged or ask your own question.