谷粒商城学习——P123修改linux网络设置

首先说下,这节课之前,我的网就是通的,并没有设置网关和DNS,也不知为啥

修改192.168.56.10所在网卡,在/etc/sysconfig/network-scripts/ifcfg-eth1中

[root@10 /]# cd /etc/sysconfig/network-scripts/
[root@10 network-scripts]# vi ifcfg-eth1

添加网关和dns配置,ip地址是56.10,网关一般是56.1配置DNS1=114.114.114.114,备用DNS2=8.8.8.8

GATEWAY=192.168.56.1
DNS1=114.114.114.114
DNS2=8.8.8.8

 保存退出后,重启网卡

[root@10 network-scripts]# service network restart

重启后就可以了。不过ping baidu.com没ping通,ping taobao.com倒是可以通

原文地址:https://www.cnblogs.com/yanan7890/p/15616598.html