1. 程式人生 > >Linux_入門之網路管理及DHCP伺服器搭建

Linux_入門之網路管理及DHCP伺服器搭建


<<命令>>
ifconfig 網絡卡 ip netmask    ##臨時設定

nmcli connection add type ethernet con-name westos ifname eth0 autoconnect yes
nmcli connection add type ethernet con-name westos ifname eth0 ip4 ip/24
nmcli connection delete westos
nmcli connection show
nmcli connection down westos
nmcli connection up westos
nmcli connection modify "westos" ipv4.addresses newip/24
nmcli connection modify "westos" ipv4.method <auto|manual>
nmcli device connect eth0
nmcli device disconnect eth0
nmcli device show
nmcli device status



<<檔案>>
dhcp        ##動態獲取
vim /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0        ##介面使用裝置
BOOTPROTO=dhcp        ##網絡卡工作模式
ONBOOT=yes        ##網路服務開啟時自動啟用
NAME=eth0        ##網路介面名稱
:wq
systemctl restart network



static|none    ##靜態網路
vim /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0             ##裝置
BOOTPROTO=static|none         ##裝置工作方式
ONBOOT=yes             ##開啟網路服務啟用裝置
NAME=eth0             ##網路介面名稱
IPADDR=172.25.0.100          ##IP
NETMASK=255.255.255.0 | PREFIX=24 ##子網掩碼