树莓派修改eth0静态网络地址

cp /etc/network/interfaces /etc/network/interfaces.copy

编译文件
nano /etc/network/interfaces

编辑文件

# nano编辑器操作
# 注释掉dhcp,不自动分配IP
# iface eth0 inet dhcp

# 设置

# The loopback interface  
auto lo  
iface lo inet loopback  
auto eth0  
iface eth0 inet static  
 
#your static IP  
address 192.168.1.118    

#your gateway IP  
gateway 192.168.1.1  
netmask 255.255.255.0  

#your network address "family"  
network 192.168.1.0  

重新加载网络

sudo /etc/init.d/networking restart

配置DNS服务器,若需要外部上网功能

nameserver 10.10.0.21 

 

posted @ 2020-08-06 08:38  缘起花渊  阅读(854)  评论(0编辑  收藏  举报