openEuler中的网络服务
管理网络服务
openEuler没有network服务,当我修改了网卡配置文件之后,使用以下命令进行重启,报错Failed to restart network.service: Unit network.service not found.
1 2 3 [root@localhost sshuser] Failed to restart network.service: Unit network.service not found. [root@localhost sshuser]
经过查询才知道,EulerOS
没有network
服务,而是使用NetworkManager
管理网络服务,所以直接重启这个服务即可。
1 [root@localhost sshuser]
让我感觉到奇怪的点是,在系统中是可以查到network
服务的,但用systemctl
和service
命令却管理不了它。
1 2 3 4 5 6 7 [root@localhost sshuser] sys-devices-pci0000:00-0000:00:12.0-virtio1-net-ens18.device loaded active plugged Virtio network device sys-subsystem-net-devices-ens18.device loaded active plugged Virtio network device network-online.target loaded active active Network is Online network-pre.target loaded active active Preparation for Network network.target loaded active active Network [root@localhost sshuser]
修改网卡配置
第二个奇怪的点是,修改网卡配置文件,掩码只能使用PEREFIX
来表示,不能使用NETMASK
,不然IP地址修改不成功了
1 2 3 IPADDR=192.168.3.138 PREFIX=24 GATEWAY=192.168.3.1
查看IP的命令
在openEuler
中,除了可以使用ip add
命令查看地址外,还可以使用nmcli
命令查看,默认自带了这两个命令。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 [root@localhost network-scripts] GENERAL.DEVICE: ens18 GENERAL.TYPE: ethernet GENERAL.HWADDR: 8E:F7:F5:E9:2A:78 GENERAL.MTU: 1500 GENERAL.STATE: 100 (connected) GENERAL.CONNECTION: ens18 GENERAL.CON-PATH: /org/freedesktop/NetworkManager/ActiveConnection/1 WIRED-PROPERTIES.CARRIER: on IP4.ADDRESS[1]: 192.168.3.138/24 IP4.GATEWAY: 192.168.3.1 IP4.ROUTE[1]: dst = 0.0.0.0/0, nh = 192.168.3.1, mt = 100 IP4.ROUTE[2]: dst = 192.168.3.0/24, nh = 0.0.0.0, mt = 100 IP6.ADDRESS[1]: 2409:8a55:8f2:xxa4:8cf7:fxxf:fxe9:xxx/64 IP6.ADDRESS[2]: 2409:8a55:8f2:xxa4:d4bb:e68f:cx3x:x/128 IP6.ADDRESS[3]: fe80::8cf7:f5ff:fee9:2a78/64 IP6.GATEWAY: fe80::1 IP6.ROUTE[1]: dst = 2409:8a55:8f2:bca4::/64, nh = ::, mt = 100 IP6.ROUTE[2]: dst = ::/0, nh = fe80::1, mt = 100 IP6.ROUTE[3]: dst = 2409:8a55:8f2:bca4:d4bb:e68f:cb34:3/128, nh = ::, mt = 100 IP6.ROUTE[4]: dst = fe80::/64, nh = ::, mt = 100 IP6.DNS[1]: fe80::1 GENERAL.DEVICE: lo GENERAL.TYPE: loopback GENERAL.HWADDR: 00:00:00:00:00:00 GENERAL.MTU: 65536 GENERAL.STATE: 10 (unmanaged) GENERAL.CONNECTION: -- GENERAL.CON-PATH: -- IP4.ADDRESS[1]: 127.0.0.1/8 IP4.GATEWAY: -- IP6.ADDRESS[1]: ::1/128 IP6.GATEWAY: -- IP6.ROUTE[1]: dst = ::1/128, nh = ::, mt = 256 [root@localhost network-scripts]