openEuler学习07-修改ip地址测试

发布时间:2023年12月19日

之前使用多的是Centos或者redhat,修改主机ip地址后,直接systemctl restart NetworkManager或systemctl restart network后,新ip地址即可生效,今天在修改一台openEuler 20.03机器时,发现不行,必须使用ifdown 网卡 && ifup 网卡。测试如下

Connecting to 172.16.55.77:22...
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.

Authorized users only. All activities may be monitored and reported.

WARNING! The remote SSH server rejected X11 forwarding request.

Authorized users only. All activities may be monitored and reported.
Last login: Tue Dec 19 13:45:13 2023 from 172.16.55.250


Welcome to 4.19.90-2112.8.0.0131.oe1.x86_64

System information as of time:Tue Dec 19 13:45:30 CST 2023

System load:???? 0.07
Processes:???? 183
Memory used:???? 1.0%
Swap used:???? 0%
Usage On:???? 5%
IP address:???? 172.16.55.77
Users online:???? 1
[root@localhost ~]# more /etc/os-release
NAME="openEuler"
VERSION="20.03 (LTS-SP3)"
ID="openEuler"
VERSION_ID="20.03"
PRETTY_NAME="openEuler 20.03 (LTS-SP3)"
ANSI_COLOR="0;31"
[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-ens32
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
IPV6_AUTOCONF=no
IPV6_DEFROUTE=no
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens32
DEVICE=ens32
ONBOOT=yes
IPADDR=172.16.55.77
NETMASK=255.255.255.0
GATEWAY=172.16.55.1
[root@localhost ~]# vi /etc/sysconfig/network-scripts/ifcfg-ens32
[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-ens32
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
IPV6_AUTOCONF=no
IPV6_DEFROUTE=no
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens32
DEVICE=ens32
ONBOOT=yes
IPADDR=172.16.55.78
NETMASK=255.255.255.0
GATEWAY=172.16.55.1
[root@localhost ~]# systemctl restart NetworkManager
[root@localhost ~]# ip a
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: ens32: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
??? link/ether 00:0c:29:0f:c5:0c brd ff:ff:ff:ff:ff:ff
??? inet 172.16.55.77/24 brd 172.16.55.255 scope global noprefixroute ens32
?????? valid_lft forever preferred_lft forever
??? inet6 fe80::20c:29ff:fe0f:c50c/64 scope link
?????? valid_lft forever preferred_lft forever
[root@localhost ~]# systemctl stop NetworkManager && systemctl start NetworkManager
[root@localhost ~]# ip a
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: ens32: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
??? link/ether 00:0c:29:0f:c5:0c brd ff:ff:ff:ff:ff:ff
??? inet 172.16.55.77/24 brd 172.16.55.255 scope global noprefixroute ens32
?????? valid_lft forever preferred_lft forever
??? inet6 fe80::20c:29ff:fe0f:c50c/64 scope link
?????? valid_lft forever preferred_lft forever
[root@localhost ~]# systemctl restart network
Failed to restart network.service: Unit network.service not found.
[root@localhost ~]# ip a
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: ens32: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
??? link/ether 00:0c:29:0f:c5:0c brd ff:ff:ff:ff:ff:ff
??? inet 172.16.55.77/24 brd 172.16.55.255 scope global noprefixroute ens32
?????? valid_lft forever preferred_lft forever
??? inet6 fe80::20c:29ff:fe0f:c50c/64 scope link
?????? valid_lft forever preferred_lft forever
[root@localhost ~]# systemctl stop NetworkManager && systemctl start NetworkManager
[root@localhost ~]#? ip a
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: ens32: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
??? link/ether 00:0c:29:0f:c5:0c brd ff:ff:ff:ff:ff:ff
??? inet 172.16.55.77/24 brd 172.16.55.255 scope global noprefixroute ens32
?????? valid_lft forever preferred_lft forever
??? inet6 fe80::20c:29ff:fe0f:c50c/64 scope link
?????? valid_lft forever preferred_lft forever
[root@localhost ~]# ifdown ens32 && ifup ens32

Socket error Event: 32 Error: 10053.
Connection closing...Socket close.

Connection closed by foreign host.

Disconnected from remote host(172.16.55.77-Vastbase1) at 13:52:57.

Type `help' to learn how to use Xshell prompt.
[C:\~]$ ssh 172.16.55.77


Connecting to 172.16.55.77:22...
Canceled.

Type `help' to learn how to use Xshell prompt.
[C:\~]$ ssh 172.16.55.78


Connecting to 172.16.55.78:22...
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.

Authorized users only. All activities may be monitored and reported.

WARNING! The remote SSH server rejected X11 forwarding request.

Authorized users only. All activities may be monitored and reported.
Last login: Tue Dec 19 13:45:45 2023 from 172.16.55.250


Welcome to 4.19.90-2112.8.0.0131.oe1.x86_64

System information as of time:???? Tue Dec 19 13:53:23 CST 2023

System load:???? 0.02
Processes:???? 193
Memory used:???? 1.0%
Swap used:???? 0%
Usage On:???? 5%
IP address:???? 172.16.55.78
Users online:???? 1

文章来源:https://blog.csdn.net/kevinyu998/article/details/135083102
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。