LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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 10-27-2010, 06:41 AM   #1
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
How to configure PC for wired/static and wired/DHCP networks?


Hello :-)

This usage scenario is not unusual but I have not found any solutions yet.

I want my netbook to connect automatically to both the office wired/static network and to the usual wired/DHCP networks.

wicd is wicked but netsearching hasn't revealed how to configure it for both wired/static and wired/DHCP except by manually switching profiles.

wicd's profiles can use pre/post(dis)connect scripts but I don't know how to integrate them into wicd when they are upping/downing connections on cable (un)plugging.

If it is not practical to solve this within wicd, I'll explore standalone scripts to configure eth0 on cable (un)plugging, as detected by ifplugd.

Happy to explore this and share results but would like the community's suggestions and knowledge before starting.

Best

Charles
 
Old 10-27-2010, 09:11 AM   #2
tkmsr
Member
 
Registered: Oct 2006
Distribution: Ubuntu,Open Suse,Debian,Mac OS X
Posts: 798

Rep: Reputation: 39
If this is in different locations rather than simultaneous, ifupdown
provides ping-places.sh to be used in "/etc/network/interfaces" to
determine which configuration to use.
http://www.cyberciti.biz/faq/setting...terfaces-file/

Last edited by tkmsr; 10-27-2010 at 09:13 AM.
 
Old 10-27-2010, 10:51 AM   #3
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578

Original Poster
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Thanks tkmsr

Yes - different places/networks, not simultaneous.

Some interesting ideas in that sample /etc/interfaces file. I prefer to identify the LAN by the MAC address of the default gateway because there are so many 192.168.0.0 and 192.168.1.0 networks and "always up" systems on a LAN are not always up (!) and can change address whereas the default gateway is more likely to be up and its MAC address is less likely to change. It's not a very robust solution but I don't know of anything better and it has been "good enough" for a while.

Design-wise, I was thinking along the lines of parallel processes to:
  1. Bring up eth0 as a DHCP interface.
  2. For each known static network: bring up eth0:x configured with static values and try to get the default gateway's MAC address to identify the network.
  3. Wait with a reasonable time to see if DHCP configures eth0 (abandon if the network is identified by any of the step 2 processes) and, if it does, identify the appropriate by the default gateway's MAC address.
  4. Remove useless/unwanted interfaces including the DHCP one even if it got a lease if it's for a network we have static settings for.
  5. At this point the network is identified as known or unknown and the script can, as appropriate, configure routing; configure DNS resolution; mount networked file systems; start services such as cups, NFS, samba, sshd ... .
 
  


Reply



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
bridging a wireless and wired network causes wired to stop working royce2020 Linux - Networking 0 04-21-2009 04:48 PM
Routing between wired and wireless networks Rostfrei Linux - Networking 2 10-17-2008 04:51 PM
Connect 2 wired networks via wireless rogerthehart Linux - Wireless Networking 8 03-21-2007 10:51 AM
NetworkManger, OpenSuSE 10.2 and Multiple WIRED Networks statguy SUSE / openSUSE 0 02-28-2007 01:15 PM
Wireless Router to Connect 2+ Wired Networks fadeone Linux - Wireless Networking 1 03-23-2006 03:14 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 04:46 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration