主機名:
如果說你沒有設(shè)置主機名的話,默認(rèn)是localhost.localdomain
修改配置文件的主機名
# hostnamectl set-hostname
查看網(wǎng)卡信息
# nmcli connection
# nmcli con show
顯示具體的網(wǎng)絡(luò)接口信息
# nmcli connection show eth0
顯示所有設(shè)配狀態(tài)
# nmcli device status
修改配置文件執(zhí)行生效
# systemctl restart network
# nmcli connection reload
顯示所有活動連接
# nmcli connection show --active
刪除一個網(wǎng)卡連接
# nmcli connection delete eth0
添加一個網(wǎng)卡連接
tcpdump: listening on eth0, link-type en10mb(ethernet), capture size 65535 bytes。listening on eth0, link-type en10mb (ethernet), capture size 65535 bytes。listening on eth0, link-type en10mb (ethernet), capture size 96 bytes。
網(wǎng)絡(luò)接口的啟用與停用:
停用:
# nmcli connection down eth0
啟用:
# nmcli connection up eth0
給eth0添加一個IP(IPADDR)
example device address string representation for 2 usrps with ipv4 addresses 192.168.10.2 and 192.168.20.2:。在控制臺中執(zhí)行ifconfig eth0 192.168.0.1 netmask 255.255.255.0linux命令linux命令,設(shè)置成192.168.0.1。auto eth0iface eth0 inet dhcp#iface eth0 inet staticaddress 192.168.0.11network 192.168.0.0netmask 255.255.255.0broadcast 192.168.0.255gateway 192.168.0.1。
給eth0添加一個子網(wǎng)掩碼(NETMASK)
# nmcli connection modify eth0 ipv4.addresses 192.168.0.58/24
IP獲取方式設(shè)置成手動(BOOTPROTO=static/none)
# nmcli connection modify eth0 ipv4.method manual
添加一個ipv4
# nmcli connection modify eth0 +ipv4.addresses 192.168.0.59/24
刪除一個ipv4
[root@svr7 ~]# nmcli connection modify eth0 ipv4.method auto #將ip設(shè)為自動獲取。example device address string representation for 2 usrps with ipv4 addresses 192.168.10.2 and 192.168.20.2:。interfaces = lo eth0 192.168.12.2/24 192.168.13.2/24。