vmware設定centos靜態ip
阿新 • • 發佈:2018-11-04
之前有過設定ubuntu靜態ip的經驗,這次安裝設定centos感覺很順利很簡單。參考https://www.linuxidc.com/Linux/2017-10/147449.htm,照做就可以了。
1.vmware的配置我之前已經修改過,還是保持不變:
2.修改centos的配置:vim /etc/sysconfig/network-scripts
#修改 BOOTPROTO=static #將dhcp改為ststic ONBOOT=yes #將no改為yes #新增 IPADDR=192.168.141.21 #靜態IP GATEWAY=192.168.141.1 #預設閘道器 NETMASK=255.255.255.0 #子網掩碼
改完後重啟網路服務:service network restart
然後就好了,真的就好了,上網以及ssh登入都沒問題,這是嘗試裝linux以來最簡單直接的一次了,檢視ip addr:
[[email protected] ~]# ip addr 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: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 link/ether 00:0c:29:35:94:01 brd ff:ff:ff:ff:ff:ff inet192.168.141.10/24 brd 192.168.141.255 scope global noprefixroute dynamic ens33 valid_lft 1458sec preferred_lft 1458sec inet 192.168.141.21/24 brd 192.168.141.255 scope global secondary ens33 valid_lft forever preferred_lft forever inet6 fe80::8a04:3629:1c8e:4e06/64 scope link noprefixroute valid_lft forever preferred_lft forever
參考文章:
1.https://www.linuxidc.com/Linux/2017-10/147449.htm