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

How to analyze Linux Network configuration

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

What this article shares with you is the analysis of how to configure the Linux network. The editor thinks it is very practical, so I share it with you. I hope you can get something after reading this article. Let's take a look at it.

After entering the Linux interface, right-click and select open terminal:

A command line window appears:

Use the ifconfig command to view the network configuration:

[root@localhost ~] # ifconfigens33: flags=4163 mtu 1500 ether 00:0c:29:b6:bb:ac txqueuelen 1000 (Ethernet) RX packets 125 bytes 7500 (7.3KiB) 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 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 76 bytes 6908 (6.7 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 76 bytes 6908 (6.7 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:36:da:62 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

Lo is a local network, don't worry about it. Virbr0 is a virtual network card, which can be deleted. You can mainly configure ens33 and delete virbr0:

[root@localhost ~] # ifconfig virbr0 down # close the virbr0 network card [root@localhost ~] # brctl delbr virbr0 # Delete the virbr0 network card [root@localhost ~] # systemctl disable libvirtd.service # because the virtual network card is created by the libvirtd service, which is not very useful in Linux Therefore, boot Removed symlink / etc/systemd/system/multi-user.target.wants/libvirtd.service.Removed symlink / etc/systemd/system/sockets.target.wants/virtlockd.socket.Removed symlink / etc/systemd/system/sockets.target.wants/virtlogd.socket is directly prohibited here.

Configure ens33:

[root@localhost ~] # cd / etc/sysconfig/network-scripts/ # Network profile path [root@localhost network-scripts] # lsifcfg-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 changes ifcfg-ens33 (the name may be different But basically this): [root@localhost network-scripts] # vim ifcfg-ens33 TYPE=Ethernet # network type BOOTPROTO=none # IP acquisition method, there are dhcp automatic acquisition and static IP (none/static) NAME=ens33 # network name UUID=d1755a41-8026-42f1-871d-9cd78fa2aa3c DEVICE=ens33 # driver name ONBOOT=yes # set boot IPADDR=192.168.137.3 # set static IP address NETMASK=255.255.255.0 # subnet mask GATEWAY=192.168.137.254 # gateway DNS1=114.114.114.114 # DNSDNS2=202.96.134.133

Restart the network service after saving and exiting:

[root@localhost network-scripts] # systemctl restart network.service

Check again:

[root@localhost network-scripts] # ifconfigens33: flags=4163 mtu 1500 inet 192.168.137.2 netmask 255.255.255.0 broadcast 192.168.137.255 inet6 fe80::20c:29ff:feb6:bbac prefixlen 64 scopeid 0x20 ether 00:0c:29:b6:bb:ac txqueuelen 1000 (Ethernet) RX packets 898 bytes 60524 (59.1 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 26 bytes 3920 (3.8 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 100 bytes 9716 (9.4 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 100 bytes 9716 (9.4 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

You can see that IP has changed. To be on the safe side, you can ping:

[root@localhost network-scripts] # ping 192.168.137.2PING 192.168.137.2 (192.168.137.2) 56 (84) bytes of data.64 bytes from 192.168.137.2: icmp_seq=1 ttl=64 time=0.142 ms64 bytes from 192.168.137.2: icmp_seq=2 ttl=64 time=0.045 ms64 bytes from 192.168.137.2: icmp_seq=3 ttl=64 time=0.030 ms64 bytes from 192.168.137.2: icmp_seq=4 ttl=64 time=0.063 ms64 bytes from 192.168.137.2: icmp_seq=5 ttl=64 time=0.033 ms

At this point, the network configuration is complete.

The above is the analysis of how to configure the Linux network. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.

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