Network configuration
From TALinuxWiki
Contents |
Basic configuration
Network interfaces can be configured using files in the
/etc/network/
directory. Any extra custom network settings can be specified in
/etc/rc.d/rc.net.local
the
/etc/rc.d/rc.net
file is reserved for future internal use and might get overwritten.
Profiles
TA-Linux support different network profiles, with their own configuration. All normal network settings can be modified. So for example when using a laptop at home, at work and on the road you can have different IP settings for all network cards (ethernet, wireless, gsmdata/gprs), different host and domainname and different DNS settings.
Network settings are stored in a profile configuration file in /etc/network/. The files must be named with a prefix of "interfaces.", for example interfaces.default for the profile "default". The active profile can be changes with the program ifprofile.
Example profile configuration file
# # Example staic IP #if_name[0]=eth0 #if_ip[0]=192.168.1.1 #if_ip6[0]= #if_netmask[0]=255.255.255.0 # # Example DHCP #if_name[0]=eth0 #if_ip[0]=dhcp #if_netmask[0]= # # Simple ad-hoc dhcp wlan #if_name[1]=wlan0 #if_ip[1]=dhcp #if_mode[1]=ad-hoc #if_essid[1]=mywlan # #if_name[2]=eth1 #if_ip[2]=dhcp # # Example bonding #if_name[3]=bond0 #if_ip[3]=dhcp #if_devices[3]="eth2 eth3 eth4" # # Example bridge #if_name[4]=br0 #if_ip[4]=dhcp #if_devices[4]="eth2 eth3 eth4" # #Default route #default_route=10.0.0.254 # # Host data # If not defined then defaults from rc.conf is used # #hostname=samplehost #domain=domain.not.set # # Nameservers #nameservers="192.168.1.254 192.168.1.253" # # Load firewall script # /etc/network/firewall.profile_name #firewall=yes #
Name servers
If you are using just one profile, then name servers are configured in the classic way, using just the /etc/resolv.conf file.
Example resolv.conf
domain tal.org nameserver 192.168.1.254
If you are using multiple profiles with different nameservers then you should not use resolv.conf (unless the nameservers are the same), as the nameservers defined in the profiles will overwrite resolv.conf each time you change the active profile. To use profile specific nameservers, add or uncomment a line in your network profile file:
nameservers="192.168.1.254 192.168.1.253"
Change the nameservers to the ones you use.
Static routes
Firewall
To use firewall rules, specify:
firewall=yes
In your network profile file and add a file firewall.name_of_profile to /etc/network/ . This file should be saved with iptables-save as it is loaded with iptables-restore.
