linux command line setting network connection (server setup)

Keywords: network REST vim

I installed cent os7 on my old DELL computer as a normal development server, and the notebook usually has WIFI and wired network card, so set this notebook as a server with dual network card. See more( www.omob.cc)

When I install cent os7, I will minimize the installation. However, during the installation process, during the graphical setting stage, I opened the wifi connection, and I will not talk about the rest according to my own settings.

After the system is installed, wifi is automatically connected after power on, but the wired network card is not connected.

  • When we find that we cannot connect to the Internet, we run the following command or ping command.

It is found that wlp1s0 (wifi network card) is connected normally with LAN address 192.168.31.101, and p4p1 (wired network card) is not connected, so there is no LAN ground temporarily.

[root@thinkcent thinktik]# ip  addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    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: p4p1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 84:8f:69:d1:5c:97 brd ff:ff:ff:ff:ff:ff
3: wlp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 68:5d:43:7f:90:f4 brd ff:ff:ff:ff:ff:ff
    inet 192.168.31.101/24 brd 192.168.31.255 scope global noprefixroute dynamic wlp1s0
       valid_lft 42317sec preferred_lft 42317sec
    inet6 fe80::ebc:6394:c13d:b0ad/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
  • Let's modify the network card configuration file and try to open the p4p1 (wired network) connection
[root@thinkcent thinktik]# cd  /etc/sysconfig/network-scripts/

[root@thinkcent network-scripts]# ls
ifcfg-lo       ifdown-ppp       ifup-ippp    ifup-TeamPort
ifcfg-p4p1     ifdown-routes    ifup-ipv6    ifup-tunnel
ifcfg-qwert45  ifdown-sit       ifup-isdn    ifup-wireless
ifdown         ifdown-Team      ifup-plip    init.ipv6-global
ifdown-bnep    ifdown-TeamPort  ifup-plusb   keys-qwert45
ifdown-eth     ifdown-tunnel    ifup-post    network-functions
ifdown-ippp    ifup             ifup-ppp     network-functions-ipv6
ifdown-ipv6    ifup-aliases     ifup-routes
ifdown-isdn    ifup-bnep        ifup-sit
ifdown-post    ifup-eth         ifup-Team

[root@thinkcent network-scripts]# vim ifcfg-p4p1 



TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=dhcp
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=p4p1
UUID=eb70970c-92a8-4836-9dc6-1c954b1ff76b
DEVICE=p4p1
#Modify yes here, change ONBOOT to yes, and save to exit
ONBOOT=yes

#Restart network
[root@thinkcent network-scripts]# service network restart

# The connection of p4p1 is normal. The IP address of LAN is 192.168.31.58. The connection is normal
[root@thinkcent network-scripts]# ip  addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    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: p4p1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 84:8f:69:d1:5c:97 brd ff:ff:ff:ff:ff:ff
    inet 192.168.31.58/24 brd 192.168.31.255 scope global noprefixroute dynamic p4p1
       valid_lft 42286sec preferred_lft 42286sec
    inet6 fe80::7622:7ed9:e8b8:3cb8/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
3: wlp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 68:5d:43:7f:90:f4 brd ff:ff:ff:ff:ff:ff
    inet 192.168.31.101/24 brd 192.168.31.255 scope global noprefixroute dynamic wlp1s0
       valid_lft 41310sec preferred_lft 41310sec
    inet6 fe80::ebc:6394:c13d:b0ad/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever

Posted by Jonah Bron on Sat, 15 Feb 2020 07:21:08 -0800