[Linux] Network connection settings


Writing time : 2017-03-26 12:43:12

Network connection settings

Connection check


To check if the network is connected, check the response from Google Public DNS using ping.

If there is no network connection, a message indicating that it cannot be connected is displayed as follows.

#ping 8.8.8.8  
connect: Network is unreachable  

IP allocation check


If you check with the ip addr command, the IP has not been assigned to the wired LAN (enp1s0) yet.

#ip addr  
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1  
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00  
inet 127.0.0.1/8 scope host lo  
valid_lft forever preferred_lft forever  
inet6 ::1/128 scope host  
valid_lft forever preferred_lft forever  
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000  
link/ether 3c:97:0e:3f:48:74 brd ff:ff:ff:ff:ff:ff  
3: wlp2s0b1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN qlen 1000  
link/ether 9e:3f:87:e3:b9:a6 brd ff:ff:ff:ff:ff:ff  

Check your settings


Since the device name is ifcfg-enp1s0, you can check the device configuration by using the following command.

# cat /etc/sysconfig/network-scripts/ifcfg-enp1s0  
TYPE=Ethernet  
BOOTPROTO=dhcp  
DEFROUTE=yes  
PEERDNS=yes  
PEERROUTES=yes  
IPV4_FAILURE_FATAL=no  
IPV6INIT=yes  
IPV6_AUTOCONF=yes  
IPV6_DEFROUTE=yes  
IPV6_PEERDNS=yes  
IPV6_PEERROUTES=yes  
IPV6_FAILURE_FATAL=no  
IPV6_ADDR_GEN_MODE=stable-privacy  
NAME=enp1s0  
UUID=af5a6430-977a-4358-9bdf-907af757755e  
DEVICE=enp1s0  
ONBOOT=no  

ONBOOT, which is assigned an IP by dhcp and automatically assigned an IP at boot time, is set to no.
ONBOOT must be set to yes in order to automatically receive IP allocation during booting.

Get an address automatically


If you enter the device name to be assigned ip after the ifup command, the IP is automatically assigned using DHCP.

# ifup enp1s0  
Connection successfully activated ...  

If you check again with the ip addr command, you can see that ip is assigned.

# ip addr  
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1  
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00  
inet 127.0.0.1/8 scope host lo  
valid_lft forever preferred_lft forever  
inet6 ::1/128 scope host  
valid_lft forever preferred_lft forever  
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000  
link/ether 3c:97:0e:3f:48:74 brd ff:ff:ff:ff:ff:ff  
inet 192.168.25.14/24 brd 192.168.25.255 scope global dynamic enp1s0  
valid_lft 3546sec preferred_lft 3546sec  
inet6 fe80::4205:c2:ca3c:8fc5/64 scope link  
valid_lft forever preferred_lft forever  
3: wlp2s0b1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN qlen 1000  
link/ether e6:de:1a:d4:a3:b3 brd ff:ff:ff:ff:ff:ff  
Next post

Other posts in the category