linux操作-----配制外网访问

1.使用网线连接arm 开发板至 可以上外网的路由器
2.配制开发板ip地址,和路由器网段一致
~ # ifconfig
eth0 Link encap:Ethernet HWaddr A2:38:3B:D9:87:B2
inet addr:192.168.4.13 Bcast:192.168.4.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:154 errors:0 dropped:0 overruns:0 frame:0
TX packets:87 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:13814 (13.4 KiB) TX bytes:7016 (6.8 KiB)
Interrupt:12

3.测试 是否能够局域网通信
~ # ping 192.168.4.1
PING 192.168.4.1 (192.168.4.1): 56 data bytes
64 bytes from 192.168.4.1: seq=0 ttl=64 time=1.263 ms
64 bytes from 192.168.4.1: seq=1 ttl=64 time=0.955 ms
64 bytes from 192.168.4.1: seq=2 ttl=64 time=0.924 ms
64 bytes from 192.168.4.1: seq=3 ttl=64 time=1.163 ms
64 bytes from 192.168.4.1: seq=4 ttl=64 time=1.149 ms
64 bytes from 192.168.4.1: seq=5 ttl=64 time=1.138 ms

4.配制访问外网
配制网关:route add default gw 192.168.4.1
配制DNS:vim /etc/resolv.conf
nameserver 221.228.255.1
nameserver 114.114.114.114
nameserver 8.8.8.8
5.:ping www.baidu.com
~ # ping www.baidu.com
PING www.baidu.com (14.215.177.39): 56 data bytes
64 bytes from 14.215.177.39: seq=0 ttl=54 time=20.739 ms
64 bytes from 14.215.177.39: seq=1 ttl=54 time=21.006 ms
64 bytes from 14.215.177.39: seq=2 ttl=54 time=21.794 ms
64 bytes from 14.215.177.39: seq=3 ttl=54 time=20.933 ms

6.设置自启动 vim /etc/init.d/rcS 添加以下内容
route add default gw 192.168.4.1

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值