Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
problems switching between two networks on laptop
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
115552
Tux's lil' helper
Tux's lil' helper


Joined: 09 Aug 2005
Posts: 108

PostPosted: Sun May 06, 2007 6:19 am    Post subject: problems switching between two networks on laptop Reply with quote

hi all..

I have a laptop which i have to work in between my home and at work. At work, it's just a simple 10.0.0.0/8 network, and at home it's a 192.168.1.0/24 network, but with NFS shares, automounted at boot to my laptop with /etc/conf.d/nfsmount.

I need to be able to take my laptop to work without the hassle of waiting 10 minutes for it to timeout from not finding the NFS shares, and I also need to automate its nameserver recognition. So, here are my questions.

With home network (192.168.1.0) and work network (10.0.0.0). I have two /etc/conf.d/net.home and net.work,

Code:
cat /etc/conf.d/net.home

config_eth0=( "192.168.15.68 netmask 255.255.255.0" )
routes_eth0=( "default gw 192.168.15.1" )


Code:
cat /etc/conf.d/net.work
config_eth0=( "10.0.0.68 netmask 255.0.0.0" )
routes_eth0=( "default gw 10.0.0.5" )


Depending on where I am, i just copy /etc/conf.d/net.home or /etc/conf.d/net.work to /etc/conf.d/net and restart eth0. In this thread if i refer to net.home or net.work, it means that i'm copying them to net, and restarting.

But I found two problems.


1)
The nameservers arn't being updated in /etc/resolve.conf. Each network has two nameservers. I have to manually edit /etc/resolve.conf and comment out the two I don't need. Is there a way to automate this? To tell net.work and net.home to update resolve.conf with their own nameservers respectively ?


2) I had nfsmount running in my default RC when booting up. If i'm at home, that's fine. If i go to work and startup the machine, it takes 10 minutes waiting until it timesout from all the NFS shares. As a temporary solution, ihad to disable nfsmount, and run it manually whenever Ii'm back at home.

Is there a way to tell my laptop to only run nfsmount from net.home, and not from net.work ?


Finally, the way I've set it up as shown, with net.home and net.work, Is this a good method or are there better ones ?

Thanks.
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6835
Location: Blighty

PostPosted: Sun May 06, 2007 9:50 am    Post subject: Reply with quote

OK, we have a few automated means of doing this for you. The easiest solution would be to install a DHCP server at each end and then use DHCP on the clients. If that's not possible, then you can do network detection by use of arping. See net.example in /etc/conf.d/ for how to do this.

Another method is to use different runlevels for home and work. You already have conf.d/net.home and conf.d/net.work - did you know that if you created the runlevels home and work then those config files would be used? Heh.
http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=2&chap=4#doc_chap5

Then you just remove the netmount init script from whichever runlevel doesn't have the NFS servers.

There you have it, 3 solutions. Enjoy :)
_________________
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Back to top
View user's profile Send private message
115552
Tux's lil' helper
Tux's lil' helper


Joined: 09 Aug 2005
Posts: 108

PostPosted: Sun May 06, 2007 12:32 pm    Post subject: Reply with quote

UberLord wrote:
OK, we have a few automated means of doing this for you. The easiest solution would be to install a DHCP server at each end and then use DHCP on the clients. If that's not possible, then you can do network detection by use of arping. See net.example in /etc/conf.d/ for how to do this.


Nah, unfortunately at home i need a specific static ip address for all my shares, nfs, and p2p to work. As for work, they do have a DHCP server, but takes me to a different IP range. I need a static ip for work because i'm hosting a http server.

Arping, that i've never heard of. I would give it a try but the bottom sounds better :)

Quote:
Another method is to use different runlevels for home and work. You already have conf.d/net.home and conf.d/net.work - did you know that if you created the runlevels home and work then those config files would be used? Heh.
http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=2&chap=4#doc_chap5
Then you just remove the netmount init script from whichever runlevel doesn't have the NFS servers.


That i didn't know! i'll try it out when i'm back home. It sounds like a very nice idea.

Thanks for the help, i'll reply when i've done the modifications.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum