VMware:host-only方式网络设置
主机为windows2003,VMware为linux,主机可以和虚拟机互联、虚拟机可以上网的host-only方式网络设置
一、添加本地连接的"internet 连接共享"。
二、设置VM linux的ip。
[work@el7 ~]$ cat /etc/sysconfig/network-scripts/ifcfg-ens33
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=dhcp
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=no
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens33
UUID=2a300305-282a-45f2-954a-b69785aeffa7
DEVICE=ens33
ONBOOT=yes
# add
IPADDR=192.168.137.2
NETMASK=255.255.255.0
GATEWAY=192.168.137.1
DNS1=114.114.114.114
DNS2=123.123.123.123
[work@el7 ~]$
然后执行:
service network restart
查看ip地址:
[root@el7 work]# ip a
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:af:ed:5f brd ff:ff:ff:ff:ff:ff
inet 192.168.137.2/24 brd 192.168.137.255 scope global noprefixroute ens33
valid_lft forever preferred_lft forever
inet6 fe80::20c:29ff:feaf:ed5f/64 scope link
valid_lft forever preferred_lft forever
[root@el7 work]# ping baidu.com
PING baidu.com (110.242.68.66) 56(84) bytes of data.
64 bytes from 110.242.68.66 (110.242.68.66): icmp_seq=1 ttl=48 time=17.0 ms
64 bytes from 110.242.68.66 (110.242.68.66): icmp_seq=2 ttl=48 time=20.2 ms
64 bytes from 110.242.68.66 (110.242.68.66): icmp_seq=3 ttl=48 time=14.9 ms
^C
--- baidu.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2017ms
rtt min/avg/max/mdev = 14.998/17.451/20.292/2.178 ms
[root@el7 work]#
三、关闭windows公用网络防火墙,或新建防火墙入站规则。
四、解决ssh登录慢的问题
UseDNS no
更多推荐
所有评论(0)