回答

收藏

嵌入式学习-ElfBoard ELF 1-设置静态IP可上外网

其他 其他 1212 人阅读 | 0 人回复 | 2023-11-01

本帖最后由 eefocus_3944881 于 2023-11-1 09:13 编辑

1.配置文件路径/etc/network/interfaces
root@ELF1:~# vi /etc/network/interfaces
例如修改eth0静态IP为192.168.2.232:
# Wired or wireless interfaces
auto eth0
#iface eth0 inet dhcp
#iface eth1 inet dhcp
iface eth0 inet static
        address 192.168.2.232
        netmask 255.255.255.0
        gateway 192.168.2.1
       hwaddress ether aa:cc:dd:ee:ff:dd


2.设置DNS
root@ELF1:~# vi /etc/rc.local
添加如下命令:
echo "nameserver 8.8.8.8" >/etc/resolv.conf


3.重启network服务
root@ELF1:~# /etc/init.d/networking restart

4.上网测试
root@ELF1:~# ping www.elfboard.com

数据返回正常可上外网。

分享到:
回复

使用道具 举报

您需要登录后才可以回帖 注册/登录

本版积分规则

关闭

站长推荐上一条 /3 下一条