How to Set and activate an IP address in Linux? We can use the command to set the IP address, but the premise of this method is
The condition is that the user requires the root permission. In linux/etc/sysconfig/network-script/ifcfg-eth0
The file contains information about Nic IP Address Configuration. The specific format is: [root @ localhostnetwork-scripts] # catifcfg-eth0 DEVICE = eth0 www.2cto.com BOOTPROTO = none ONBOOT = yes TYPE = Ethernet NETMASK = 255.255.255.0 IPADDR = IP address USERCTL = no PEERDNS = yes GATEWAY = GATEWAY address (Router IP address) the following is an example of how to set IP addresses in Linux. # Ifconfigeth0192.168.0.1 or modify the ifcfg-eth0 under/etc/sysconfig/network-scripts/# vi/etc/syssconfig/network-scripts/ifcfg-eth0 DEVICE = eth0 BOOTPROTO = static HWADDR =; here is the physical address of your network card. You do not need to enter the network card that is usually detected.
ONBOOT = yes IPADDR = 192.168.0.1 NETMASK = 255.255.255.0 NETWORK = 192.168.1.0 BROADCAST = 192.168.1.255 GATEWAY =; enter your GATEWAY here, save the IP address of the router and exit www.2cto.com #/sbin/servicenetworkrestart. If the Enable Nic is OK, the IP address is successfully set. In addition, we can use ifconfigeth0 to display the current IP address to confirm whether it is set correctly.
Run the following command:/etc/init. d/networkreload or servicenetwork [command] to re-import the file to start the network.