moving laptop between networks

Posted on 1999-07-15
Medium Priority
Last Modified: 2010-04-20
i have a laptop with Redhat 6.0 installed and it is connected to my network at home (this all works fine so far)

i take my laptop to client sites, such as the one where i am currently contracting and often need to connect to their network.

Given that i have all the relevant information about their network such as ip addresses, netmasks, network names, etc.
what is the recommended way to configure my laptop so that i can switch it on and boot into the right choice for the network that i am connected to?

basically i don't want to have to edit the
and probably some other files every time i change network
but would instead like to set up a profile for each network that i connect to.

plus can you advise on what services that i should be sure to turn off before connecting to their network so that i don't interfere with their network.

So far the only documentation specific to this problem that I can find is some old information on a program called netenv (plus loads of general info such as NAGs HOWTOs etc)

Any help would be appreciated,
Question by:kie27

Expert Comment

ID: 1635389
Do you have dhcp available at work and at home?

Author Comment

ID: 1635390
no, neither at work nor at home,

LVL 51

Expert Comment

ID: 1635391
AFAIK, the simplest way to do it, is to write a script like:

route flush
ifconfig eth0 down
ifconfig eth0 <IP-address> netmask <netmask> broadcast <broadcast> up
route add -net dev eth0
route add -net <net for IP-address>
route add -net default <gateway>
mv /etc/resolv.conf{,.old}

You don't need to change /etc/printcap when connecting to another network, just add all printers you like.
awk '/^nameserver/{print "nameserver <IP-of-nameserver>"}' /etc/resolv.conf.old > /etc/resolv.conf
kill -1 <pid of named>   # or better restart named

7 new features that'll make your work life better

It’s our mission to create a product that solves the huge challenges you face at work every day. In case you missed it, here are 7 delightful things we've added recently to monday to make it even more awesome.


Expert Comment

ID: 1635392

Expert Comment

ID: 1635393
the hangup signal for named will work beautifully, but when doing everything from out of a script, it will be easier to do it with "ndc restart". putting everything in a script, as ahoffman suggested, and including the call of awk and ndc will give you everything you need.

boot up your system, call the script, done.

don't worry about your services. generaly, they will not "go out on the network and disturb the others". the are resident on your host and activated only if requested from YOUR ip.

Author Comment

ID: 1635394
Thanks for the help.  I will create the scripts as suggested
including the awk and ndc restart.

Does the comment about services also hold for sendmail or
do I need to be more careful with this?
LVL 51

Expert Comment

ID: 1635395
as long as there is no change needed in sendmail.cf, you don't need to take care about sendmail (it is usually configure to use DNS).

Accepted Solution

Rabs earned 200 total points
ID: 1635396
recently I found some script on www.linuxapps.com about it, a set of script that you can use like this:

 setneton client1
 setnetoff client1
 setneton client2

Take a look at linuxapps, I don't remember the name now, sorry

Featured Post

A proven path to a career in data science

At Springboard, we know how to get you a job in data science. With Springboard’s Data Science Career Track, you’ll master data science  with a curriculum built by industry experts. You’ll work on real projects, and get 1-on-1 mentorship from a data scientist.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
Can you run Linux on a Windows system?  Yep.  Here's how.
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses

600 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question