How to set ip in linux

Release: 2019-12-30 17:18:33
Original
6741 people have browsed it

How to set ip in linux

How to set the IP address in Linux:

File ifcfg-eth0 file path required to configure the network:/eth/sysconfig/network-scripts/ifcfg-eth0

ifcfg-eth0 file configuration analysis:

TYPE=Ethernet  
DEVICE=eth0  
BOOTPROTO=none  
ONBOOT=yes  
IPADDR=192.168.16.12  
NETMASK=255.255.255.0  
GATEWAY=192.168.16.1  
BROADCAST=192.168.16.255
HWADDR=00:0C:29:13:5D:74  
PEERDNS=yes  
DNS1=10.0.1.41  
USERCTL=no  
NM_CONTROLLED=no  
IPV6INIT=yes  
IPV6ADDR=FD55:fe80::28c2:e745:835f:c8d0/64
Copy after login

Attachment. Configuration parameter description
Note: These parameter values ​​​​are not case-sensitive, do not distinguish between single quotes and double quotes, and may not even be used quotation marks.
TYPE: Configuration file interface type. There are various network configuration files in the /etc/sysconfig/network-scripts/ directory, including Ethernet, IPsec and other types. The network interface type is Ethernet.

DEVICE: Network interface name

BOOTPROTO: System startup address protocol

none: Do not use startup address protocol

bootp: BOOTP protocol

dhcp: DHCP dynamic address protocol

static: Static address protocol

ONBOOT: Whether to activate when the system starts

yes: Activate the network interface when the system starts

no: Do ​​not activate this network interface when the system starts

IPADDR: IP address

NETMASK: Subnet mask

GATEWAY: Gateway address

BROADCAST: Broadcast address

Configuration takes effect

In order to make the network configuration permanently valid, the network interface configuration file under /etc/sysconfig/network-scripts/ was modified in Part 2. However, modifications to these files will not take effect immediately. There are two ways to make the network configuration of the modified file take effect:

1) Execute the service network restart command to restart the network service (recommended)

# service network restart
Copy after login

2) Restart the computer

# reboot
Copy after login

Recommended learning: linux tutorial

The above is the detailed content of How to set ip in linux. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template