outgoing trafi c when you have two ethnet interface


I have two ethernet interface on the RH enterprise linux box which is configure as follow:

Eth0 : 192.168.168.1
Eth1 : 192.168.168.2

On a hardware firewall on the network I have configured that to allow all the trafic incoming/outgoing from eth0
And deny any trafic from eth1. but when I try to ping out I see on the firewall log screen that trafic is coming from eth1.

Now, How do I tell the OS that when I do ping out or try to reach outside world use the eth0 interface.

Thanks,

Raza
razaAsked:
Who is Participating?
 
alextoftConnect With a Mentor Commented:
You can specify the interface using the route command. Say your default gateway is 192.168.168.254, use

route add default gw 192.168.168.254 eth0

0
 
ravenplCommented:
Is Your box acting as bridge? Or both ethX are plugged in same LAN segment?
It's raher strange to have two ethX configured with IPs from same logical LAN(192.168.168.0/255.255.255.0)
0
 
ravenplCommented:
And please post here:
ip addr
ip route
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
razaAuthor Commented:

I am not using as bridge.

I do not have access to the machine right now to send you the out put of ip addr and ip route. I will send it later today.

but if both gateway is same and when I run "ping anyserver.com" how it decide that what would be the source ip address.

0
 
razaAuthor Commented:

Let say I have this :

Eth0 : 192.168.168.2  GW 192.168.168.254
Eth1 : 192.168.170.2  GW 192.168.170.254

if I "ping  anyserver.com"  what would be the source ip address when it reach to the gw.
0
 
ravenplCommented:
It depends what is set as default gw (output of: ip route) and to what IP address anyserver.com will resolve.
Do You have two default GW set in the system - I don't think so (hence it's possible).
0
 
razaAuthor Commented:
thanks for you quick response.


therefore, the source IP address would be the one from whatever eth0 or eth1 is set for defaul route?
0
 
ravenplCommented:
if 192.168.170.254 is the default route and anyserver.com resolves to other than 192.168.168.X then the source IP would be
192.168.170.2
0
 
ravenplCommented:
> route add default gw 192.168.168.254 eth0
It's not really like Your sollution - try with eth1  You'll see this command fails...
0
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.

All Courses

From novice to tech pro — start learning today.