I have a Debian linux OS and use it in my office and in my home. The network configuration i use is using static configuration. I have problem with this, when i swicth from home to office network, the configuration is different, the routing also different.
Everytime I switch network, I have to open the configuration file in /etc/network/interfaces and enable / disable configuration line.
So I do some research and found that we can create a multiple configuration in the interface file. so when we have let say 2 config called home and office, we switch the configuration by issuing this command :
#ifup eth0=home #ifdown eth0=home #ifup eth0=office #ifdown eth0=office
So lets go with the example , file /etc/network/interfaces :
auto lo iface lo inet loopback #home config iface home inet static address 192.168.1.100 netmask 255.255.255.0 broadcast 192.168.1.255 gateway 192.168.1.111 dns-nameserver 8.8.8.8 #Office config iface office inet static address 192.168.100.100 netmask 255.255.255.0 broadcast 192.168.100.255 gateway 192.168.100.24 dns-nameservers 8.8.8.8 up route add -net 172.16.0.0 netmask 255.255.0.0 gw 192.168.100.99
With this config file we can just set the interface configuration to the one we need. Example when in office issue this command :
#ifup eth0=office
If in home, just issue :
#ifup eth0=home With this configuration, we not need to touch the configuration files.How about the GUI ? Well, i am a server guy, so command line is powerfull enough for me.
0 comments:
Post a Comment