Linux provides a number of tools for network configuration. Most important network settings for you Linux machine to access over network are
- IP configuration
- Device activation
- DNS configuration
- Default gateway
1. Default Network Configuration Files:
- Default linux interfaces configuration file exists in /etc/sysconfig/network-scripts/ named ifcfg-ethX ( ‘X’ is replace with number 0,1 or 2 etc ).
- /etc/sysconfig/network : is global configuration file
NETWORKING = yes HOSTNAME = server1.tecadmin.net GATEWAY = 192.168.10.1
- /etc/sysconfig/network-script/ifcfg-ethX : is Ethernet configuration file so assign ip address, netmask on interface.
- /etc/resolv.conf : DNS servers ip addresses are specified in this file.
- /etc/hosts : Is used for locally resolve a hostname with ip.
2. Device Configuration:
There are two ways to configure network device to get ip address. 1- In dynamic configuration system gets ip address and other network details from dhcp server where in static configuration we set the fixed ip address and network details in interfaces configuration files. Below is the example file of network interfaces.
Advertisement
Dynamic Configuration:
DEVICE = ethX
HWADDR = 00:33:5A:9B:74:99
BOOTPROTO = dhcp
ONBOOT = yes
TYPE = Ethernet
Static Configuration:
DEVICE = ethX
HWADDR = 00:33:5A:9B:74:99
BOOTPROTO = static
IPADDR = 192.168.10.100
NETMASK = 255.255.255.0
GATEWAY = 192.168.10.1
ONBOOT = yes
TYPE = Ethernet
USRCTL = no
Details of configuration parameters:
- DEVICE: Ethernet device name
- HWADDR: Hardware address or MAC address
- BOOTPROTO: dhcp or static
- ONBOOT: yes/no , it tells that interface will automatically up or not on boot.
- Type: Type of interface.
- USRCTL: yes/no , it tells that a non root user can bring this device up or down.
If you do not want to edit files directly, you can use `setup` command to configure network interfaces
1 Comment
i use these settings to set static ip but it change to that ip when i turn on my VM. my network on bridge adopter . my network is 196.156.22.1 and ip i get when machine is boot is 196.156.22.29 and i set my ip to 196.156.22.50 but when i restart my network the ip is change into again 196.156.22.29. and also BOOTPROTO is turn into static to none.
I have already disable the DHCP of virtualbox.
please help ASAP.