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 :
Eth1 :

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.


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

route add default gw eth0

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(
And please post here:
ip addr
ip route
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.

razaAuthor Commented:

Let say I have this :

Eth0 :  GW
Eth1 :  GW

if I "ping  anyserver.com"  what would be the source ip address when it reach to the gw.
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).
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?
if is the default route and anyserver.com resolves to other than 192.168.168.X then the source IP would be
> route add default gw eth0
It's not really like Your sollution - try with eth1  You'll see this command fails...
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.