Jump to content

Network devices - which is default? [solved]


griptypethyne
 Share

Recommended Posts

I have a dial up device and an ethernet device. I have discovered how to turn each on and off. I have also diiscovered that I can have both on at the same time. If I had two network cards presumably I could have three network devices open at the same time and so on.

 

This is my question - when Firefox or other client asks the OS for a connection how does Linux decide which device to use?

 

A second question, which is probably related - if I use ifconfig to turn off eth0 and open a dial up connection I can browse for a while and them the network fails. When I run ifconfig I discover that eth0 has started automatically. Howcan I stop it from doing sio (apart from the crude solution of deleting eth0)?

Link to comment
Share on other sites

You need to set the default gateway to the device you wish to use.

 

To view the routing table, type route -n

 

If you look at this when on/off line you should see what's happening.

 

To change the default gateway manually, use

route add default gw <ip address> <interface>

So for eth0 with a gateway of 192.168.0.1, use route add default gw 192.168.0.1 eth0

For dial up, it gets set automatically, but you may find you need to remove the current default gateway first with

route del default

This can be entered in the kppp pre-dialup code box as

kdesu route del default

if you need it.

 

To stop eth0 taking over the gateway, remove the line GATEWAY=xxx.xxx.xxx.xxx in /etc/sysconfig/network.

 

I think there may be a graphical way to do all this using profiles - anyone?

You could also write a script to do the job.

All commands to be entered as root.

 

Chris

Link to comment
Share on other sites

You need to set the default gateway to the device you wish to use.

 

To view the routing table, type route -n

 

Thanks for that. I had a complete mental block B) The routing table and the route command is the solution.

 

I currently have a dial up connection and an adsl modem attached to an ethernet port. I am waiting for my ISP to switch me over to adsl. As a learning exercise I wanted to set my system up so that all connections were made to dialup *except* for 10.1.1.1, which is the adsl modem set up page. Using the route command I was able to do this. I will no longer panic and think re-install Linux whenever I get a "cannot establish connection" or similar message.

 

ISTM that one of the disadvantages of being a long time windows user is that, because there is no proper command shell, I did not have the opportunity to experiment with such commands and find out how things worked.

 

Qchem edit: fixed quote.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...