How To Configure a Network Interface In Linux?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
1. Open the terminal window and type “ifconfig”. This will show you the current IP address and the network interfaces associated with the system.
2. To configure a network interface, type “ifconfig <interface name> <IP address>”. Replace <interface name> with the name of the interface you wish to configure and <IP address> with the IP address you wish to assign.
3. To enable or disable a network interface, type “ifup <interface name>” or “ifdown <interface name>”.
4. To set a default gateway, type “route add default gw <IP address>”. Replace <IP address> with the IP address of the gateway.
5. To set DNS servers, edit the /etc/resolv.conf file. Add the IP addresses of the DNS servers you want to use, one per line.
6. To configure a static route, type “route add -net <network address> netmask <netmask> gw <IP address>”. Replace <network address> with the network address you want to route to, <netmask> with the subnet mask for the network, and <IP address> with the IP address of the gateway.
7. To save your configuration, type “/sbin/route-save”. This will save your configuration to the /etc/sysconfig/network-scripts/ directory.
8. Finally, restart the network service with the command “/etc/init.d/network restart”.