赞
踩
IP地址为:192.1683.2.152
记一下起始IP和结束IP,和网关信息
关注4个点
[root@test ~]# vi /etc/sysconfig/network-scripts/ifcfg-ens33
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens33
UUID=0c92e631-d4be-4a05-b212-dd7a0849e4a7
DEVICE=ens33
ONBOOT=yes
IPADDR=192.168.2.130
NETMASK=255.255.255.0
GATEWAY=192.168.2.1 我犯错的地方GATEWAY这个单词写错
DNS1=192.168.2.1 DNS和网关设置一样就OK,参考下图
~
[root@test ~]# vi /etc/sysconfig/network
# Created by anaconda
NETWORKING=yes
HOSTNAME=test 名字随便
GATEWAY=192.168.2.1 默认网关和宿主机一样
[root@test ~]# vi /etc/resolv.conf
# Generated by NetworkManager
search com
nameserver 192.168.2.1
个人感觉上面添加网关地址和DNS多余
systemctl stop firewalld.service
systemctl disable firewalld.service 开机重启永久生效
systemctl restart network.service
ip addr或者ifconfig
[root@test ~]# ping www.baidu.com
PING www.baidu.com (61.135.169.121) 56(84) bytes of data.
64 bytes from www.baidu.com (61.135.169.121): icmp_seq=1 ttl=55 time=14.6 ms
64 bytes from www.baidu.com (61.135.169.121): icmp_seq=2 ttl=55 time=13.7 ms
64 bytes from www.baidu.com (61.135.169.121): icmp_seq=3 ttl=55 time=14.0 ms
64 bytes from www.baidu.com (61.135.169.121): icmp_seq=4 ttl=55 time=13.7 ms
^C
--- www.baidu.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3004ms
rtt min/avg/max/mdev = 13.772/14.058/14.647/0.383 ms
虚拟机本地CRT(远程连接工具或XSHELL)远程访问服务器
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。