I am resonably new to Linux (I mean really new) and I have hit a problem. I have a machine with Linux with an extra nic card. When trying to use eth1 to connect to my network I am able to get an address through DHCP but unable to get a default gateway. Unfortunately with having multiple subnets in use this becomes a problem for me as I can still get to all other addresses within the same subnet as they are using layer 2 not 3.
I have found a way to get the default gateway on to the machine through DHCP however this is a fix that needs to be applied everytime I change subnets. The fix I use is as follows:
ifconfig eth1 down
I find that when I do move from subnet to subnet the nic seems to keep the previous address and I am unable to drop this address unless I complete the commands above which in turn gives me the desired gateway.
So after that rant is there a way for me to move from subnet to subnet where the nic picks up the new ip address and the default gateway automatically rather than going through the commands mentioned above?
Hmmm.. let me see if I understand this, you have two NIC's and two subnets that you want to use. I would look and binding each card to a unique subnet, you should then be able to use route to specify which direction requests are sent. I've done this a long time ago on an NT system with FDDI / 100BaseT cards.
I used to run two NIC's on my home rig, one bound to static details for a DMZ and the other to a standard NAT/DHCP connection to the router. I kept it REALLY simple and just swapped the cable!
Thanks for the reply being a newbie I've realised that although I have two nics one internal and one external the internal is only used for receiving data. My problem was that unless I have the ethernet plugged in on startup it will not get the default gateway. If I plug the cable in after startup it does not get the gateway but does get an address.
Therefore I think I have answered my own question because when I change subnets the ip address is kept on the nic card and I presume the release command are the commands I entered above. If there is an easier way to release the ip address and renew ie one command like ipconfig /release on windows I would be grateful if you could let me know.
I realised that a reboot with the cable connected work by using the "init 6" command.