V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
Admstor
V2EX  ›  问与答

raspberry 的网络配置问题

  •  
  •   Admstor · 2016-01-15 17:04:02 +08:00 · 1376 次点击
    这是一个创建于 3039 天前的主题,其中的信息可能已经有所发展或是发生改变。
    raspberry B
    从官方下了 raspbian 烧卡安装都正常
    然后像配置静态 IP 方便使用
    配置文件反复核对都无误,但是每次重启后必须要 route add default gw 才能正常的连接外网

    之前还有奇怪的和 USB 无线网卡冲突的问题,不过暂时解决了
    就这个无法理解。。。

    求助

    补充一下配置vi /etc/network/interface

    # interfaces(5) file used by ifup(8) and ifdown(8)

    # Please note that this file is written to be used with dhcpcd
    # For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

    # Include files from /etc/network/interfaces.d:
    source-directory /etc/network/interfaces.d

    auto lo
    iface lo inet loopback

    auto eth0
    #iface eth0 #inet manual
    iface eth-0 inet static
    address 10.1.10.69
    netmask 255.255.0.0
    gateway 10.1.10.1
    broadcast 10.1.255.255
    dns-nameserver 114.114.114.114
    5 条回复    2016-01-15 18:00:08 +08:00
    WD40
        1
    WD40  
       2016-01-15 17:12:41 +08:00
    sudo nano /etc/network/interfaces

    auto lo
    iface lo inet loopback
    iface eth0 inet static 

    allow-hotplug wlan0
    #iface wlan0 inet static
    iface wlan0 inet manual
    wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
    address 10.1.10.69
    netmask 255.255.255.0
    gateway 10.1.10.1
    iface default inet dhcp
    wireless-power off


    sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

    network={

    ssid="你的路由器芳名"
    psk="路由器密码"
    proto=RSN
    key_mgmt=WPA-PSK
    pairwise=CCMP TKIP
    group=CCMP TKIP
    auth_alg=OPEN
    }


    其实不必在树莓上配置固定 IP ,直接在路由器上登记 MAC ADDRESS 后指派 IP 即可。
    jasontse
        2
    jasontse  
       2016-01-15 17:16:37 +08:00 via iPad
    iface eth-0 inet static
    是什么鬼
    jasontse
        3
    jasontse  
       2016-01-15 17:17:26 +08:00 via iPad
    顺便安利一下 dietpi.com
    Admstor
        4
    Admstor  
    OP
       2016-01-15 17:32:28 +08:00
    @WD40 感谢回答,但似乎并没有什么用
    依旧是需要 route 一下
    WD40
        5
    WD40  
       2016-01-15 18:00:08 +08:00
    @Admstor 有从开机或 sudo /etc/init.d/networking restart 吗 ?

    或者可以参考这里 http://www.wikihow.com/Add-or-Change-the-Default-Gateway-in-Linux
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   3263 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 10:48 · PVG 18:48 · LAX 03:48 · JFK 06:48
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.