基于MAC-VMWARE配置静态IP

计划

#获取可使用的IP段落
cat /Library/Preferences/VMware\ Fusion/vmnet8/dhcpd.conf  | grep range
结果:range 172.16.160.128 172.16.160.254;
#获取子网掩码
cat /Library/Preferences/VMware\ Fusion/vmnet8/dhcpd.conf  | grep netmask
结果:subnet 172.16.160.0 netmask 255.255.255.0 {
#获取网关
cat /Library/Preferences/VMware\ Fusion/vmnet8/dhcpd.conf  | grep 'option routers'
结果: option routers 172.16.160.2;
#获取广播地址
cat /Library/Preferences/VMware\ Fusion/vmnet8/dhcpd.conf  | grep broad
结果:option broadcast-address 172.16.160.255;
计划IP:172.16.160.133
子网掩码:255.255.255.0
网关:172.16.160.2
DNS:223.5.5.5

配置前状况

[bigdata@bigdata ~]$ su - root
Password: 
[root@bigdata ~]# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:50:56:20:A0:E9  
          inet6 addr: fe80::250:56ff:fe20:a0e9/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:57 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 b)  TX bytes:17910 (17.4 KiB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:8 errors:0 dropped:0 overruns:0 frame:0
          TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:480 (480.0 b)  TX bytes:480 (480.0 b)

[root@bigdata ~]# ls  /etc/sysconfig/network-scripts/ifcfg-eth* 
/etc/sysconfig/network-scripts/ifcfg-eth0

配置

vim  /etc/sysconfig/network-scripts/ifcfg-eth0 

#修改
改前:BOOTPROTO=dhcp
改后:BOOTPROTO=none
#追加
#“NETMASK=255.255.255.0”一般是存在的
IPADDR=172.16.160.133
GATEWAY=172.16.160.2
DNS1=223.5.5.5

网卡在启动

ifdown eth0;ifup eth0

配置后状况

[root@bigdata ~]# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:50:56:20:A0:E9  
          inet addr:172.16.160.133  Bcast:172.16.160.255  Mask:255.255.255.0
          inet6 addr: fe80::250:56ff:fe20:a0e9/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:146 errors:0 dropped:0 overruns:0 frame:0
          TX packets:262 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:56065 (54.7 KiB)  TX bytes:50007 (48.8 KiB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:160 errors:0 dropped:0 overruns:0 frame:0
          TX packets:160 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:11856 (11.5 KiB)  TX bytes:11856 (11.5 KiB)

[root@bigdata ~]# 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值