NetworkManager
此时yast无法配置
tonixtom:/etc/sysconfig/scripts # systemctl status NetworkManager
● NetworkManager.service - Network Manager
Loaded: loaded (/usr/lib/systemd/system/NetworkManager.service; enabled; vendor preset: disabled)
Drop-In: /usr/lib/systemd/system/NetworkManager.service.d
└─NetworkManager-ovs.conf
Active: active (running) since Sun 2022-04-03 21:08:33 CST; 7min ago
Docs: man:NetworkManager(8)
Main PID: 4796 (NetworkManager)
Tasks: 4
CGroup: /system.slice/NetworkManager.service
├─4602 /sbin/dhclient -d -q -sf /usr/lib/nm-dhcp-helper -pf /var/run/dhclient-eth0.pid -lf /var/lib/Networ>
└─4796 /usr/sbin/NetworkManager --no-daemon
Apr 03 21:08:55 tonixtom NetworkManager[4796]: <info> [1648991335.0945] device (eth0): state change: prepare -> conf>
Apr 03 21:08:55 tonixtom NetworkManager[4796]: <info> [1648991335.2530] device (eth0): state change: config -> ip-co>
Apr 03 21:08:55 tonixtom NetworkManager[4796]: <info> [1648991335.2793] device (eth0): state change: ip-config -> ip>
Apr 03 21:08:55 tonixtom NetworkManager[4796]: <info> [1648991335.2806] device (eth0): state change: ip-check -> sec>
Apr 03 21:08:55 tonixtom NetworkManager[4796]: <info> [1648991335.2808] device (eth0): state change: secondaries -> >
Apr 03 21:08:55 tonixtom NetworkManager[4796]: <info> [1648991335.2809] manager: NetworkManager state is now CONNECT>
Apr 03 21:08:55 tonixtom NetworkManager[4796]: <info> [1648991335.2815] manager: NetworkManager state is now CONNECT>
Apr 03 21:08:55 tonixtom NetworkManager[4796]: <info> [1648991335.2816] policy: set 'eth0' (eth0) as default for IPv>
Apr 03 21:08:55 tonixtom NetworkManager[4796]: <info> [1648991335.2816] device (eth0): Activation: successful, devic>
Apr 03 21:08:55 tonixtom NetworkManager[4796]: <info> [1648991335.9109] manager: NetworkManager state is now CONNECT>
tonixtom:/etc/sysconfig/scripts # systemctl status wicked
● wicked.service - wicked managed network interfaces
Loaded: loaded (/usr/lib/systemd/system/wicked.service; disabled; vendor preset: disabled)
Active: inactive (dead)
tonixtom:~ # nmcli device connect eth0
Device 'eth0' successfully activated with '08806fca-ccae-49bc-8d37-cd7731d2c29a'.
tonixtom:/etc/sysconfig/scripts # nmcli connection show
NAME UUID TYPE DEVICE
eth0 74b0c140-3bd7-406e-97c9-0657a8edc970 ethernet eth0
tonixtom:/etc/sysconfig/scripts # nmcli -p device
=====================
Status of devices
=====================
DEVICE TYPE STATE CONNECTION
--------------------------------------------------------------
eth0 ethernet connected eth0
lo loopback unmanaged --
tonixtom:/etc/sysconfig/scripts # nmcli dev status
DEVICE TYPE STATE CONNECTION
eth0 ethernet connected eth0
lo loopback unmanaged --
tonixtom:~ # nmcli dev show eth0
GENERAL.DEVICE: eth0
GENERAL.TYPE: ethernet
GENERAL.HWADDR: 00:0C:29:34:88:C1
GENERAL.MTU: 1500
GENERAL.STATE: 100 (connected)
GENERAL.CONNECTION: Profile 1
GENERAL.CON-PATH: /org/freedesktop/NetworkManager/ActiveConnection/2
WIRED-PROPERTIES.CARRIER: on
IP4.ADDRESS[1]: 192.168.31.168/24
IP4.GATEWAY: 192.168.31.1
IP4.ROUTE[1]: dst = 0.0.0.0/0, nh = 192.168.31.1, mt = 100
IP4.ROUTE[2]: dst = 192.168.31.0/24, nh = 0.0.0.0, mt = 100
IP4.DNS[1]: 192.168.31.1
IP6.ADDRESS[1]: fe80::a8fc:d89f:3edc:c31f/64
IP6.GATEWAY: --
IP6.ROUTE[1]: dst = ff00::/8, nh = ::, mt = 256, table=255
IP6.ROUTE[2]: dst = fe80::/64, nh = ::, mt = 256
IP6.ROUTE[3]: dst = fe80::/64, nh = ::, mt = 100
tonixtom:~ #
tonixtom:/etc/sysconfig/network # nmcli connection
NAME UUID TYPE DEVICE
Profile 1 08806fca-ccae-49bc-8d37-cd7731d2c29a ethernet eth0
看到name为profile 1,说明配置文件不对,在详细信息界面删除当前连接 配置,重新建立一个配置,设置为eth0。
静态ip配置
- 在界面上的network界面进行配置,(由当前Gnome桌面控制的NetworkManager)
- 命令配置
tonixtom:~ # systemctl restart NetworkManager.service
tonixtom:/etc/sysconfig/scripts # nmcli con mod eth0 ipv4.method manual
tonixtom:/etc/sysconfig/network # nmcli con mod eth0 ipv4.addresses 192.168.31.170/24
tonixtom:/etc/sysconfig/network # nmcli con mod eth0 ipv4.gateway 192.168.31.1
tonixtom:/etc/sysconfig/network # nmcli con mod eth0 ipv4.dns "202.97.224.69"
tonixtom:/etc/sysconfig/network # nmcli con up eth0
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/3)
tonixtom:/etc/sysconfig/scripts # ifconfig | grep "inet " | sed 's/^\s*//' | cut -d' ' -f 1,2
inet 192.168.31.170
inet 127.0.0.1
#记录
systemctl disable NetworkManager
systemctl enable NetworkManager
systemctl stop NetworkManager
Wicked 设置网络
使用wicked network网络
tonixtom:~ # systemctl status NetworkManager
● NetworkManager.service - Network Manager
Loaded: loaded (/usr/lib/systemd/system/NetworkManager.service; disabled; ve>
Drop-In: /usr/lib/systemd/system/NetworkManager.service.d
└─NetworkManager-ovs.conf
Active: inactive (dead)
Docs: man:NetworkManager(8)
Apr 03 22:22:22 tonixtom NetworkManager[952]: <info> [1648995742.8944] policy:>
Apr 03 22:22:23 tonixtom NetworkManager[952]: nisdomainname: you must be root t>
Apr 03 22:22:23 tonixtom NetworkManager[952]: <info> [1648995743.7486] device >
Apr 03 22:22:23 tonixtom NetworkManager[952]: <info> [1648995743.7493] manager>
Apr 03 22:22:25 tonixtom NetworkManager[952]: <info> [1648995745.3687] manager>
Apr 03 22:37:38 tonixtom systemd[1]: Stopping Network Manager...
Apr 03 22:37:38 tonixtom NetworkManager[952]: <info> [1648996658.4755] caught >
Apr 03 22:37:38 tonixtom NetworkManager[952]: <info> [1648996658.4766] manager>
Apr 03 22:37:38 tonixtom NetworkManager[952]: <info> [1648996658.4774] exiting>
Apr 03 22:37:38 tonixtom systemd[1]: Stopped Network Manager.
tonixtom:~ # systemctl status wicked #yast配置后,这时wicked是启动的
● wicked.service - wicked managed network interfaces
Loaded: loaded (/usr/lib/systemd/system/wicked.service; enabled; vendor pres>
Active: active (exited) since Sun 2022-04-03 22:37:45 CST; 1min 58s ago
Process: 5992 ExecStart=/usr/sbin/wicked --systemd ifup all (code=exited, sta>
Main PID: 5992 (code=exited, status=0/SUCCESS)
Apr 03 22:37:40 tonixtom systemd[1]: Starting wicked managed network interfaces>
Apr 03 22:37:45 tonixtom wicked[5992]: lo up
Apr 03 22:37:45 tonixtom systemd[1]: Started wicked managed network interfaces.
tonixtom:/etc/sysconfig/network # systemctl restart wickedd.service #重启wicked服务
tonixtom:/etc/sysconfig/network # wicked ifup eth0 #配置后启动网口
eth0 up
tonixtom:/etc/sysconfig/network # cat ifcfg-eth0
BOOTPROTO='static'
STARTMODE='hotplug'
ZONE='public'
IPADDR='192.168.31.172'
NETMASK='255.255.255.0'
tonixtom:/etc/sysconfig/network # wicked ifstatus eth0
eth0 up
link: #2, state up, mtu 1500
type: ethernet, hwaddr 00:0c:29:34:88:c1
config: compat:suse:/etc/sysconfig/network/ifcfg-eth0
leases: ipv4 static granted
addr: ipv4 192.168.31.170/24
addr: ipv4 192.168.31.172/24 [static]
route: ipv4 default via 192.168.31.1 metric 100 proto static
静态ip配置
- 可以在yast-界面设置网络
2. 可以配置ifcfg文件 ,在networkmanager下面这个配置貌似不管用。
tonixtom:~ # cat /etc/sysconfig/network/ifcfg-eth0
BOOTPROTO='static'
STARTMODE='hotplug'
ZONE='public'
IPADDR='192.168.31.172'
NETMASK='255.255.255.0'