LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
Search this Thread
Old 05-18-2004, 03:06 PM   #1
kleag
LQ Newbie
 
Registered: May 2004
Posts: 4

Rep: Reputation: 0
Question Need to set up 2 IP configs and choose auto the good one


Hi,

I have a laptop (Mandrake 10.0 Community) that I use at work and at home. At work, it is connected to a LAN with a fixed non-private IP address. At home, it is connected by an Ethernet link to a PC with Linux/XP connected to the Internet by ADSL. There it uses a fixed private IP 192.168.0.2 but it could use DHCP if needed. Note that both connections use the same Ethernet eth0.

My problem is that I have to manually switch network config two times a day. I'd like to choose automatically the good configuration or at least to select the good one at boot time in LILO.

Do you know a solution for that ?

Kleag
 
Old 05-18-2004, 05:05 PM   #2
ranger_nemo
Senior Member
 
Registered: Feb 2003
Location: N'rn WI -- USA
Distribution: Kubuntu 8.04, ClarkConnect 4
Posts: 1,142

Rep: Reputation: 47
In /etc/sysconfig/network-scripts/ifcfg-eth0, you should find the network info. Make two copies of it, with the set-up for both networks. You should then be able to write a script that attempts to contact the network after booting... If it can't contact the gateway, then it can switch the network set-up, restart the eth0, and attempt to contact again. If it can't contact after switching, it can tell you so.

Code:
My /etc/sysconfig/network-scripts/ifcfg-eth0...

# 3Com Corporation|3c905B 100BaseTX [Cyclone]
DEVICE=eth0
BOOTPROTO=static
BROADCAST=192.168.0.255
HWADDR=00:C0:4A:44:70:8E
IPADDR=192.168.0.11
NETMASK=255.255.255.0
NETWORK=192.168.0.0
ONBOOT=yes
TYPE=Ethernet
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Set wireless configs automatically apocoloco Linux - Wireless Networking 4 10-22-2005 11:43 AM
Choose Linux stand in internet Cafe, is it good idea? and why? Khmer Linux - General 2 08-26-2005 03:12 AM
Unable to choose good dial-up provider for linux Itami Linux - Software 3 11-30-2004 01:41 PM
Let's choose a good distro for my lapper topper :) orange400 Linux - Distributions 6 05-01-2004 11:37 AM
How to choose a good mirror for apt-get/Synaptic Eugene Linux - General 6 12-08-2003 11:17 AM


All times are GMT -5. The time now is 10:07 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration