Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have SL 6.3 installed on two machines.

Machine A is a workstation and has two interface eth0 and wlan0. Using eth0, it is connected to Machine B (public facing server) with static IP address. Both connect to the internet through their respective wlan0 interface.

The problem is when the workstation is connected to the server, it sends all the packets including those of the internet to eth0 and therefore fails. To use the internet on workstation, I need to disconnect eth0 and if I do so then my SSH connection (over eth0)to the server hangs!

Is there someway, I can compel my workstation to send internet packets to wlan0 irrespective of the connection state of eth0.

share|improve this question

2 Answers 2

This is more of routing problem. You need to change the routing table of your workstation A to make it to work.

Let us suppose that eth0 of Machine A has ip 10.10.1.1 and wlan0 has ip 172.16.1.1.

You should change routing table of machine A so that the default route should point to wlan0 while the route for subnet 10.10.1.0 should point to eth0.

You can do this by using iproute2 package.

You can look at the machine A routing table by:

$ sudo ip route show

This should show you a line stating that your default gateway is eth0. You need to delete this line using following command:

$ sudo ip route del default dev eth0

then add the new default route through wlan0.

$ sudo ip route add default dev wlan0 

And add route to the other machine B to route traffic for that box using eth0

$ sudo ip route add 10.10.1.0/24 dev eth0
share|improve this answer
    
You don't need to use sudo just to list the existing routes. You should also point out that these manual changes will not survive a reboot, network restarts or the respective interfaces being brought down and up again. –  itsbruce Oct 30 '12 at 18:30
    
Also, there is nothing in the question to indicate that it is necessary to add a route on Machine B. There might be a need for such a step but the questioner has said nothing to indicate such a problem. –  itsbruce Oct 30 '12 at 18:32

You need to make sure the default route is set to go via wlan0. You probably also want to set an explicit route for Machine B via eth0.

If you are comfortable editing config files manually, you will find the files you need in /etc/sysconfig/network-scripts. The files you care about are called ifcfg-eth0 and ifcfg-wlan0. You should make sure that ifcfg-wlan0 contains a GATEWAY setting like

GATEWAY=xxx.xxx.xxx.xxx

replacing xxx.xxx.xxx.xxx with the address of your upstream router. You should remove any such line from ifcfg-eth0. That done, you can fix the routing issue by bringing down both interfaces and then bringing them back up again, or by restarting networking, which you can do by running

service network restart

As I said, I also think you should add a route that makes sure traffic to Machine B goes via eth0. One way to do this is to create the file /etc/sysconfig/network-scripts/route-eth0 and make it executable, because it will be run each time eth0 is brought up or down. It should have a line like

xxx.xxx.xxx.xxx via eth0

replacing xxx.xxx.xxx.xxx with the ip address of Machine B.

This route will take effect after you have brought eth0 down and up, or restarted networking.

If you are not comfortable at the command line, you will need to find the Red Hat config tools that let you do the same thing.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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