1 Laptop needs setting uo for work and home
I use my laptop at home and work and I do not want to keep changing default gateways, ip ranges and dns's etc what is the best way to get round this.
Thanks Chris Also if I have an ip address of 172.16.0.13 and a linksys broadband router of 192.168.1.1 how do make them talk to each so that I can access the internet. |
I actually use two scripts that I coded up, one for use at work, and one for at home. Of course these are greatly simplified, but you get the idea.
Code:
# cat home |
Thanks for the scripts.
I am a novice Linux person so excuse the daft questions. 1)What do I call the files including extensions. 2)Which Directory do I put them in. 3)How and when do I run the one I want. I have just had a thought is it possible to use network manager and use the wired connection for work and the wireless for home. Chris |
I tend to use the GUI as little as possible -- perhaps that's due to my Slackware background, which is why I have actually never used the network manager.
You may put these scripts really anywhere you'd like -- I myself just keep them in root's home directory (/root), for easy access when I `su` to root. Before using the above scripts for your own setup, make sure to read the ifconfig man page, and if applicable (for wireless), iwconfig. To write those scripts, I just opened up vi (a text-editing program) from the command line and entered the above, saving the first as 'home' and the second as 'work'. You have to make sure they are executable, by using the `chmod` program. Again, read its man page for additional help. Unlike in Windows, there is no specific extention that makes a script or program executable; it's all handled through the file's permissions, which again are edited by `chmod`. To execute those commands, I just run `su -c "/root/home"` or `su -c "/root/work"` as necessary. Others may have their own favored methodologies for doing this, but mine works for me and is fairly straightforward. The important part is that these files have to be run as root, because normally ifconfig, iwconfig, route, and resolv.conf aren't able to be accessed by normal, unprivileged users. Also, if you update your profile information to include your distribution, it can help people here at LQ tailor their responses to your specific distro. |
I don't know what distribution you're using, but Mandriva has something called "Network profiles", configured in GUI from the Mandriva Control Center.
You should probably investigate and see if your distribution provides something equivalent. Yves. |
I use Fedora 9. I will update my profile.
I have set the files up and chmod 100 the files but when I try to run them with su -c "workh" it comes back with command not found. Am I right in thinking I can setup the wired to one subnet and wireless to another. Thanks for your time Chris |
That you can -- something with using su -c however is that you need to tell it exactly where the file is, since it's likely not in your PATH. If your 'workh' is in /root, try `su -c "/root/workh"` instead.
|
Why don't you just use DHCP? Your router will offer it, chances are where you work does too.
|
I second the recommendation for DHCP. If you want a static IP at home, then you can configure your DHCP server (probably your router) to always serve up the same IP address for your laptop's MAC address.
|
Thanks boys.
That is what I decided to do - seems like much less hassle. Thanks for all your advice Chris |
All times are GMT -5. The time now is 12:33 AM. |