树莓派配置网络

1.配置ip地址

编辑sudo nano  /etc/network/interfaces

自动获取ip的配置:

auto eth0
    allow-hotplug eth0
    iface eth0 inet dhcp

手动配置ip:

 auto eth0
    iface eth0 inet static
        address 192.168.0.7
        netmask 255.255.255.0
        gateway 192.168.0.254

2.配置DNS

编辑 sudo nano /etc/resolv.conf

domain lan
search lan
nameserver 192.168.1.1
nameserver 192.168.99.100

注:nameserver 后面的ip就是dns服务器,根据自己的运营商情况填吧

 

发表评论