Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Network Settings in CentOS 7

2025-03-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

View network interface information ifconfig command [root@localhost ~] # ifconfig / / View network interface information ens33: flags=4163 mtu 1500 inet 192.168.144.133 netmask 255.255.255.0 broadcast 192.168.144.255 inet6 fe80::a85a:c203:e2e:3f3c prefixlen 64 scopeid 0x20 ether 00:0c:29:5b:d3:a0 txqueuelen 1000 (Ethernet) RX Packets 6139 bytes 3599390 (3.4MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 2483 bytes 330519 (322.7 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0lo: flags=73 mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6:: 1 prefixlen 128 scopeid 0x10 loop txqueuelen 1 (Local Loopback) RX packets 84 bytes 7500 (7.3 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 84 bytes 7500 (7.3 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0virbr0: flags=4099 mtu 1500 inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255 ether 52:54:00:d9:de:d2 txqueuelen 1000 (Ethernet) RX packets 0 bytes 0 (0.0B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 Bytes 0 (0.0B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 View specified network interface information ifconfig network interface [root@localhost] # ifconfig ens33 / / View ens33 network interface information ens33: flags=4163 mtu 1500 inet 192.168.144.133 netmask 255.255.255.0 broadcast 192.168.144.255 inet6 fe80::a85a:c203:e2e:3f3c prefixlen 64 scopeid 0x20 ether 00V0c: 29:5b:d3:a0 txqueuelen 1000 (Ethernet) RX packets 6183 bytes 3602858 (3.4MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 2505 bytes 334073 (326.2 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 View host name View or set current host name hostname command [root@localhost ~] # hostname / / View host name localhost.localdomain change host name hostnamectl set-hostname [host Machine name] [root@localhost ~] # hostnamectl set-hostname http01 / / change hostname [root@localhost ~] # su / / switch users Refresh hostname [root@http01 ~] # hostname / / View hostname http01 View routing table entries View routing table route command [root@http01 ~] # route / / View routing table Kernel IP routing tableDestination Gateway Genmask Flags Metric Ref Use Ifacedefault gateway 0.0.0.0 UG 10000 ens33192.168.122.0 0. 0.0.0 255.255.255.0 U 00 0 virbr0192.168.144.0 0.0.0.0 255.255.255.0 U 10000 ens33 View Network connection

View the network connection status, routing table, interface statistics and other information of the system

Netstat command

Netstat [options]

Common option

-a: all

-n: display in digital format

-p: protocol

-t: tcp

-u: udp

-r: routin

[root@http01 ~] # netstat-antp / / View the network connection of all TCP protocol ports in digital format Active Internet connections (servers and established) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0 0. 0 antp 111 0.0.0 0 * LISTEN 1/systemd Tcp 0 192.168.122.1 LISTEN 983/sshd tcp 53 0.0.0.0 * LISTEN 1308/dnsmasq tcp 0 0 0.0.0.0 22 0.0.0.0 * LISTEN 983/sshd tcp 0 0127.0.0.1 0.0.0.0 * LISTEN 985/cupsd tcp 0 0127.0.0.1 LISTEN 4840/sshd 25 0.0.0.0 LISTEN 4840/sshd : root@pts tcp 0 0192.168.144.133 ESTABLISHED 4840/sshd 22 192.168.144.1 ESTABLISHED 4840/sshd: root@pts tcp6 0 0:: 111: * LISTEN 1/systemd tcp6 0 0: 80:: * LISTEN 2373/httpd tcp6 0 0: 22: * LISTEN 983/sshd tcp6 0 0:: 1 LISTEN 985/cupsd tcp6 0 0:: 1:25 : * LISTEN 1292/master tcp6 0 0:: 1 root@pts 6010: * LISTEN 4840/sshd: root@pts [root@http01 ~] # netstat-nuap / / View the network connection of all UDP protocol ports in digital format Active Internet connections (servers And established) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name udp 0 0 0.0.0 0 788/dhclient udp 36571 0.0.0 0 * 788/dhclient udp 0 0 0.0.0 0 v 47956 0.0.0 0 578/avahi-daemon: r udp 0 0 192.168.122.1 1308/dnsmasq udp 53 0.0.0.0 1308/dnsmasq udp 0 0 0.0.0.0 7 0.0.0 0 1308/dnsmasq udp 0 0.0.0.0udp 68 0.0.0.0udp * 578/avahi-daemon: r 0127.0.0.1 udp 323 0.0. 0.0636/chronyd * 636/chronyd udp6 0 0: 57996: * 788/dhclient udp6 0 0:: 1 Root@http01 ~] # netstat-r / / View routing information Same as route command Kernel IP routing tableDestination Gateway Genmask Flags MSS Window irtt Ifacedefault gateway 0.0.0.0 UG 000 ens33192.168.122.0 0.0.0.0 255.255.255.0 U 000 virbr0192.168.144.0 0.0.0.0 255 .255.255.0 U 000 ens33 network test connection

Test network communication

Ping command

Ping [hostname] / [IP address]

[root@http01 ~] # ping 192.168.100.10 / / Test network communication PING 192.168.100.10 (192.168.100.10) 56 (84) bytes of data.64 bytes from 192.168.100.10: icmp_seq=1 ttl=128 time=0.860 ms64 bytes from 192.168.100.10: icmp_seq=2 ttl=128 time=0.530 ms64 bytes from 192.168.100.10: icmp_seq=3 ttl=128 time=0.514 ms64 bytes from 192.168.100.10: icmp_seq=4 ttl=128 time=0.465 ms trace packet

Test the network node passing from the current host to the destination host

Traceroute command

Traceroute destination host address

[root@http01 ~] # traceroute 192.168.100.10traceroute to 192.168.100.10 (192.168.100.10), 30 hops max, 60 byte packets 1 gateway (192.168.144.2) 0.320 ms 0.255 ms 0.223 ms 2 * 3 * 4 * Domain name resolution

Test DNS domain name resolution

Nslookup command

Nslookup [destination host address] / [destination DNS address]

[root@http01 ~] # nslookup www.baidu.comServer: 192.168.144.2Address: 192.168.144.2#53Non-authoritative answer:www.baidu.com canonical name = www.a.shifen.com.Name: www.a.shifen.comAddress: 183.232.231.172Name: www.a.shifen.comAddress: 183.232.231.174 set network parameters temporarily-use command to adjust network parameters

It is simple and fast, and the running network parameters can be modified directly.

Generally, it can only be used in the process of debugging the network.

After reboot, the changes will invalidate the fixed settings-the configuration file for modifying network parameters through the configuration file is suitable for setting fixed parameters on the server to use the parameters that need to be reloaded or restarted before setting the network interface parameters effectively.

Temporarily set the IP address and subnet mask of the network interface

Ifconfig interface name IP address [netmask (subnet mask)]

[root@http01 ~] # ifconfig ens33 / / View the IP address of the ens33 interface ens33: flags=4163 mtu 1500 inet 192.168.144.133 netmask 255.255.255.0 broadcast 192.168.144.255 inet6 fe80::a85a:c203:e2e:3f3c prefixlen 64 scopeid 0x20 ether 00:0c:29:5b:d3:a0 txqueuelen 1000 (Ethernet) RX packets 42 bytes 3966 (3.8 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 86 bytes 9346 (9.1 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 [root@http01 ~] # ifconfig ens33 192.168.144.138 ifconfig ens33 24 / / set temporary IP address [root@http01 ~] # ifconfig ens33 / / check whether ens33 is set successfully: flags=4163 mtu 1500 inet 192.168.144.138 netmask 255.255.255.0 broadcast 192.168 .57384 inet6 fe80::a85a:c203:e2e:3f3c prefixlen 64 scopeid 0x20 ether 00:0c:29:5b:d3:a0 txqueuelen 1000 (Ethernet) RX packets 2660 bytes 3613441 (3.4MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 844 bytes 57384 (144.255 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 [root@http01 ~] # systemctl restart network / / restart the network Internet service [root@http01] # ifconfig ens33 / / View IP address ens33: flags=4163 mtu 1500 inet 192.168.144.133 netmask 255.255.255.0 broadcast 192.168.144.255 inet6 fe80::a85a:c203:e2e:3f3c prefixlen 64 scopeid 0x20 ether 00:0c:29:5b:d3:a0 txqueuelen 1000 (Ethernet) / / invalid IP address RX packets 2708 bytes 3618185 (3618185 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 894 bytes 63590 (62.0 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

Set the IP address and subnet mask of the fixed network interface

Setting a fixed network interface IP address and subnet mask requires changing the configuration file in the configuration file of the network interface.

Network interface profile

/ etc/sysconfig/network-scripts/

Restart the network network service

Systemctl restart network

[root@http01 ~] # vim / etc/sysconfig/network-scripts/ifcfg-ens33 / / enter edit network card configuration file TYPE=EthernetPROXY_METHOD=noneBROWSER_ONLY=noBOOTPROTO=staticl / / change DHCP to staticlDEFROUTE=yesIPV4_FAILURE_FATAL=noIPV6INIT=yesIPV6_AUTOCONF=yesIPV6_DEFROUTE=yesIPV6_FAILURE_FATAL=noIPV6_ADDR_GEN_MODE=stable-privacyNAME=ens33UUID=2ef6b862-5201-48c5-a450-23b3720ab3a0DEVICE=ens33ONBOOT=yesIPADDR=192.168.144.138 / / enter the IP address to be set NETMAS=255.255.255.0 / / enter the subnet mask GATEWAY=192.168.144.1 / / enter the gateway address [root@http01 ~] # systemctl restart network / / restart network services [root@http01 ~] # ifconfig ens33 ens33: flags=4163 mtu 1500 inet 192.168.144.138 netmask 255.255.255.0 broadcast 192.168.144.255 inet6 fe80::20c:29ff:fe5b:d3a0 prefixlen 64 scopeid 0x20 ether 00:0c:29:5b:d3:a0 txqueuelen 1000 (Ethernet) / / address set successfully RX packets 3832 bytes 3715216 (3.5 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 1558 bytes 160876 (157.1 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

Disable or reactivate the network card

Disable the network card

Ifconfig network interface down

Reactivate the network card

Ifconfig network interface up [root@localhost ~] # ifconfig ens33 down / / disable the network card [root@localhost ~] # ifconfig ens33 / / View the network card information No IP address connection ens33: flags=4098 mtu 1500 ether 00:0c:29:5b:d3:a0 txqueuelen 1000 (Ethernet) RX packets 459 bytes 495831 (484.2 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets bytes 22865 (22.3 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 [root@localhost ~] # ifconfig ens33 up / / reactivate the network card [root@localhost ~] # Ifconfig ens33 / / View Nic information Successfully obtained the IP address ens33: flags=4163 mtu 1500 inet 192.168.144.133 netmask 255.255.255.0 broadcast 192.168.144.255 inet6 fe80::a85a:c203:e2e:3f3c prefixlen 64 scopeid 0x20 ether 00:0c:29:5b:d3:a0 txqueuelen 1000 (Ethernet) RX packets 463 bytes 496409 (484.7 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 264 bytes 26630 (26.0KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

Virtual network interface

Virtual network interface refers to sharing a network card, the same network card can be equipped with multiple IP addresses, no matter which IP address you access can access the same server. (disable the virtual network card directly when you do not want to use the virtual network card)

Ifconfig API name: serial number IP address

[root@localhost ~] # ifconfig ens33:0 192.168.144.140 / / add a virtual network card to the ens33 network card Serial number is 0 [root@localhost ~] # ifconfig / / View network card information ens33: flags=4163 mtu 1500 inet 192.168.144.133 netmask 255.255.255.0 broadcast 192.168.144.255 inet6 fe80::a85a:c203:e2e:3f3c prefixlen 64 scopeid 0x20 ether 00:0c:29:5b:d3:a0 txqueuelen 1000 (Ethernet) RX packets 653 bytes 512686 (500.6 KiB) RX Errors 0 dropped 0 overruns 0 frame 0 TX packets 373bytes 39897 TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0ens33:0: flags=4163 mtu 1500 / / Virtual network card inet 192.168.144.140 netmask 255.255.255.0 broadcast 192.168.144.255 ether 00:0c:29:5b:d3:a0 txqueuelen 1000 (Ethernet) lo: flags=73 mtu 65536 inet 127.0.0.1 netmask 255 .0.0.0 inet6:: 1 prefixlen 128 scopeid 0x10 loop txqueuelen 1 (Local Loopback). / / omit part of the content. Set up routing record

Route record added to a specified network segment

Route add-net segment address gw IP address (gateway)

Delete the route record to the specified network segment

Route del-net network segment address

Delete the default gateway record in the routing table

Route del default gw IP address add default gateway record route add default gw IP address [root@localhost ~] # route / / View routing table Kernel IP routing tableDestination Gateway Genmask Flags Metric Ref Use Ifacedefault gateway 0.0.0.0 UG 10000 ens33192.168.122.0 0.0.0.0 255.255. 255.0 U 00 virbr0192.168.144.0 0.0.0.0 255.255.255.0 U 1000 ens33 [root@localhost ~] # route add-net 192.168.100.0 route 24 gw 192.168.144.1 / add IP address range [root@localhost ~] # route / / check whether IP address range Kernel IP routing tableDestination Gateway is added to the routing table Genmask Flags Metric Ref Use Ifacedefault gateway 0.0.0.0 UG 100 00 ens33192.168.100.0 192.168.144.1 255.255.255.0 UG 00 0 ens33192.168.122.0 0.0.0.0 255.255.255.0 U 00 0 virbr0192.168.144. 0 0.0.0.0 255.255.255.0 U 10000 ens33 [root@localhost ~] # route del-net 192.168.100.0 route 24 / Delete the added IP address range [root@localhost ~] # route / / View the routing table See whether the added network segment deletes Kernel IP routing tableDestination Gateway Genmask Flags Metric Ref Use Ifacedefault gateway 0.0.0.0 UG 1000 ens33192.168.122.0 0.0.0.0 255.255.255.0 U 00 virbr0192.168.144.0 0.0.0.0 255. 255.255.0 U 1000 ens33 [root@localhost ~] # route add default gw 192.168.144.1 / add the default gateway [root@localhost ~] # route / / check whether the default gateway Kernel IP routing tableDestination Gateway Genmask Flags Metric Ref Use Ifacedefault gateway 0.0.0.0 UG 00 has been added successfully 0 ens33default gateway 0.0.0.0 UG 1000 ens33192.168.122.0 0.0.0.0 255.255.255.0 U 00 virbr0192.168.144.0 0.0.0.0 255.255.255.0 U 10000 ens33 [root@localhost ~] # route del default gw 192.168.144.1 / Delete the added default gateway [root@localhost ~] # route / / check whether the routing table has been successfully deleted Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Ifacedefault gateway 0.0.0.0 UG 10000 ens33192.168.122.0 0.0.0.0 255. 255.255.0 U 00 0 virbr0192.168.144.0 0.0.0.0 255.255.255.0 U 1000 ens33 Host name profile

Save global network settings, including hostname information

/ etc/sysconfig/network//etc/hostname

To modify the hostname in CentOS 6, you can execute "vim / etc/sysconfig/network" to modify the configuration file, while in CentOS 7 we can execute "vim / etc/hostname" to modify the hostname configuration file.

[root@localhost ~] # vim / etc/hostname / / enter the edit hostname configuration file localhost.localdomain / / if you modify the current hostname, you can modify the hostname directly in the editor ~ ~ ~ ~ Domain name resolution profile

Specify the address of the server that provides DNS resolution for this body (changes to the modified file will take effect immediately)

/ etc/resolv.conf format nameserver IP address [root@localhost ~] # vim / etc/resolv.conf # Generated by NetworkManagersearch localdomainnameserver 192.168.144.2 ~ ~ ~ Local host mapping file

Add a mapping record to the local host mapping file, and when you visit the added record website, a web request will be sent directly to the added mapping record IP address, omitting the process of resolving the IP address to the DNS server.

Save the mapping record between hostname and IP address

/ etc/hostshosts file and DNS server comparison by default, the system first looks up the parsing record from the hosts file and the hosts file is only valid for the current host hosts file can reduce the DNS query process, thus speeding up the access speed supplementary content: the establishment of dual network cards

In daily production activities, we will inevitably encounter the need to establish a dual network card. Here, let's take a look at how to establish a dual network card.

1. First add a physical network card to the virtual machine Linux operating system, and then check the network interface information to determine whether the network has been added successfully.

[root@localhost ~] # ifconfig / / View network interface information ens33: flags=4163 mtu 1500 inet 192.168.144.133 netmask 255.255.255.0 broadcast 192.168.144.255 inet6 fe80::a85a:c203:e2e:3f3c prefixlen 64 scopeid 0x20 ether 00:0c:29:5b:d3:a0 txqueuelen 1000 (Ethernet) RX packets 3415 bytes 740748 (723.3 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 1725 bytes 201799 (197.0 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0ens36: flags=4163 mtu 1500 / / newly added physical network card inet 192.168.144.141 netmask 255.255.255.0 broadcast 192.168.144.255 inet6 fe80::deb1:3cec:3e26:5ec2 prefixlen 64 scopeid 0x20 ether 00:0c:29:5b:d3:aa txqueuelen 1000 (Ethernet) RX packets 85 bytes 6069 (5.9 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 30 bytes 4667 (4.5 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

2. At this time, we check the directory of network card configuration files to see if there are any added network card configuration files.

[root@localhost ~] # cd / etc/sysconfig/network-scripts/ enter the Nic configuration file directory [root@localhost network-scripts] # ls / / View There is no ifcfg-ens33 ifdown-ipv6 ifdown-TeamPort ifup-ippp ifup-routes network-functionsifcfg-lo ifdown-isdn ifdown-tunnel ifup-ipv6 ifup-sit network-functions-ipv6ifdown ifdown-post ifup ifup-isdn ifup-Teamifdown-bnep ifdown-ppp ifup-aliases ifup-plip ifup-TeamPortifdown-eth ifdown-routes ifup-bnep of the configuration file of the newly added network card ens36 at this time. Ifup-plusb ifup-tunnelifdown-ib ifdown-sit ifup-eth ifup-post ifup-wirelessifdown-ippp ifdown-Team ifup-ib ifup-ppp init.ipv6-global

3. Because there is no configuration file for ens36 network card, we have no way to specify a fixed address for ens36. Next, we will set both ens36 and ens33 network cards to host-only connection mode, and then check the network interface information.

[root@localhost ~] # ifconfig / / View network interface information ens33: flags=4163 mtu 1500 / / No IP address inet6 fe80::a85a:c203:e2e:3f3c prefixlen 64 scopeid 0x20 ether 00:0c:29:5b:d3:a0 txqueuelen 1000 (Ethernet) RX packets 3578 bytes 754392 (736.7 KiB) RX errors 0 dropped 0 frame 0 TX packets 1812 bytes 215065 (210.0 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0ens36: flags=4163 mtu 1500 / / No hair to get IP address inet6 fe80::deb1:3cec:3e26:5ec2 prefixlen 64 scopeid 0x20 ether 00:0c:29:5b:d3:aa txqueuelen 1000 (Ethernet) RX packets 160 bytes 12321 (12.0 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 48 bytes 7865 (7.6 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

I can't get the IP address here because the DHCP service in the VMware virtual machine is turned off, so I can't get the address.

4. At this time, we will assign fixed addresses to these two physical network cards.

[root@localhost ~] # vim / etc/sysconfig/network-scripts/ifcfg-ens33 / / Edit Nic information TYPE=EthernetPROXY_METHOD=noneBROWSER_ONLY=noBOOTPROTO=static / / dhcp change to staticDEFROUTE=yesIPV4_FAILURE_FATAL=noIPV6INIT=yesIPV6_AUTOCONF=yesIPV6_DEFROUTE=yesIPV6_FAILURE_FATAL=noIPV6_ADDR_GEN_MODE=stable-privacyNAME=ens33UUID=2ef6b862-5201-48c5-a450-23b3720ab3a0DEVICE=ens33ONBOOT=yesIPADDR=192.168.100.10 / / enter the configuration IP address NETMAS=255.255.255.0 / / enter the configuration subnet mask GATEWAY=192.168 .100.0 / / enter configuration gateway ~ ~ ~ ~: wq [root@localhost ~] # service network restart / / restart network service Restarting network (via systemctl) : [OK] [root@localhost ~] # ifconfig / / View network interface information Check whether the configured address is valid ens33: flags=4163 mtu 1500 inet 192.168.100.10 netmask 255.255.255.0 broadcast 192.168.100.255 inet6 fe80::a85a:c203:e2e:3f3c prefixlen 64 scopeid 0x20 ether 00:0c:29:5b:d3:a0 txqueuelen 1000 (Ethernet) RX packets 3642 bytes 771191 (753.1 KiB) RX errors 0 dropped 0 frame 0 TX packets 1948 bytes 239617 0 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

Next, let's go to the configuration file directory of the network card. If there is no configuration file for the ens36 network card at this time, we need to copy the configuration file of ens33 directly, change it to the configuration file of ens36, and then change the contents of the configuration file.

[root@localhost ~] # cd / etc/sysconfig/network-scripts/ enter the Nic configuration file directory [root@localhost network-scripts] # ls / / View ifcfg-ens33 ifdown-isdn ifup ifup-plip ifup-tunnelifcfg-lo ifdown-post ifup-aliases ifup-plusb ifup-wirelessifdown ifdown-ppp ifup-bnep ifup-post init.ipv6-globalifdown-bnep ifdown-routes ifup- Eth ifup-ppp network-functionsifdown-eth ifdown-sit ifup-ib ifup-routes network-functions-ipv6ifdown-ib ifdown-Team ifup-ippp ifup-sitifdown-ippp ifdown-TeamPort ifup-ipv6 ifup-Teamifdown-ipv6 ifdown-tunnel ifup-isdn ifup-TeamPort [root@localhost network-scripts] # cp-p ifcfg-ens33 ifcfg-ens36 / / copy ens33 configuration file [root@localhost network-scripts] # ls / / View ifcfg-ens33 ifdown-ipv6 ifdown-tunnel ifup-isdn ifup-TeamPortifcfg-ens36 ifdown-isdn ifup ifup-plip ifup-tunnelifcfg-lo ifdown-post ifup-aliases ifup-plusb ifup-wirelessifdown ifdown-ppp ifup-bnep ifup-post init.ipv6-globalifdown-bnep ifdown-routes ifup-eth ifup-ppp network-functionsifdown-eth ifdown-sit ifup-ib Ifup-routes network-functions-ipv6ifdown-ib ifdown-Team ifup-ippp ifup-sitifdown-ippp ifdown-TeamPort ifup-ipv6 ifup-Team [root@localhost network-scripts] # vim ifcfg-ens36 / / enter edit ens36 configuration file TYPE=EthernetPROXY_METHOD=noneBROWSER_ONLY=noBOOTPROTO=staticDEFROUTE=yesIPV4_FAILURE_FATAL=noIPV6INIT=yesIPV6_AUTOCONF=yesIPV6_DEFROUTE=yesIPV6_FAILURE_FATAL=noIPV6_ADDR_GEN_MODE=stable-privacyNAME=ens36 / / change 33 to 36DEVICE=ens36 / / change 33 to 36ONBOOT=yesIPADDR=192.168.10.10 / / change IP address network segment NETMAS=255.255.255.0GATEWAY=192.168.10.0 / / change gateway address ~ ~ Note Delete the UUID entry in the configuration file Just let the system automatically recognize and add (the UUID is not the same) ~ ~ ~ ~: wq [root@localhost network-scripts] # service network restart / / restart the network service Restarting network (via systemctl): [OK] [root@localhost network-scripts] # ifconfig / / View the network card Information ens33: flags=4163 mtu 1500 inet 192.168.100.10 netmask 255.255.255.0 broadcast 192.168.100.255 inet6 fe80::a85a:c203:e2e:3f3c prefixlen 64 scopeid 0x20 ether 00:0c:29:5b:d3:a0 txqueuelen 1000 (Ethernet) RX packets 3705 bytes 788818 (770.3 KiB) RX errors 0 dropped 0 frame 0 TX packets 1978 bytes 243934 (238.2 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0ens36: flags=4163 mtu 1500 / / successfully obtained the IP address inet 192.168.10.10 netmask 255.255.255.0 broadcast 192.168.10.255 inet6 fe80::f6eb:23e3:3afb:fef4 prefixlen 64 scopeid 0x20 ether 00:0c:29:5b:d3:aa txqueuelen 1000 (Ethernet) RX packets 248bytes 33751 (32.9 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 280 bytes 49781 (48.6 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report