网络配置
使能网卡
使用ip link
查看是否存在eth0网卡,若无使用如下命令使能网卡:
ip link set eth0 up
两次使用ip link
确认网卡eth0已经使能。
配置IP、GW
本人设备连接到华为路由器下,故增加如下路由信息:
# IP、brd设置
ip addr flush dev eth0
ip addr add 192.168.3.114/24 dev eth0 brd +
# GW、路由设置
ip route add default via 192.168.3.1 dev eth0
ip route add 192.168.3.0/24 dev eth0 scope link src 192.168.3.130
配置dns
echo "nameserver 114.114.114.114" >> /etc/resolv.conf
记得使用cat出来,检查无误
ping包测试
[root@milkv]~# ping www.bing.com
PING www.bing.com (202.89.233.101): 56 data bytes
64 bytes from 202.89.233.101: seq=0 ttl=118 time=33.948 ms
64 bytes from 202.89.233.101: seq=1 ttl=118 time=33.871 ms