在 Linkit 7688 (OpenWRT) 中配置网络

在 Linkit 7688 (OpenWRT) 中配置网络

我是网络和 openWRT 的新手。我刚刚编译了一个 openWRT 版本,但没有 wifi 模块。为了传输新固件,我尝试绕过网络设置并将以太网设置为主模式。但这样做也取消了我的 wifi 连接。现在我想让这些配置永久生效(以防固件再次损坏,以某种方式使用 SSH 连接),但通过 wifi 建立可行的互联网连接。我的配置文件和ifconfig 输出下面是。我还使用openWRT 3.18.23核心。

 etc/config/network :

config interface 'loopback'
    option ifname 'lo'
    option proto 'static'
    option ipaddr '127.0.0.1'
    option netmask '255.0.0.0'

config globals 'globals'
    option ula_prefix 'fd6b:f1eb:9a25::/48'

config interface 'lan'
    option force_link '1'
    option macaddr '9c:65:f9:23:a9:cf'
    option type 'bridge'
    option proto 'static'
    option netmask '255.255.255.0'
    option ip6assign '60'
    option ipaddr '192.168.100.1'

config switch
    option name 'switch0'
    option reset '1'
    option enable_vlan '0'

config interface 'wan'
    option ifname 'eth0'
    option proto 'dhcp'
    option macaddr '9c:65:f9:23:c3:33'



etc/config/wireless :

config wifi-iface
    option device 'radio0'
    option network 'wwan'
    option mode 'sta'
    option ssid 'myssid'
    option encryption 'psk2'
    option key 'mykey'
    option disabled '0'

config interface 'wwan'
    option proto 'dhcp'

config zone
    option name 'lan'
    option input 'ACCEPT'
    option output 'ACCEPT'
    option forward 'ACCEPT'
    option network 'lan wwan'

config wifi-device 'radio0'
    option type 'ralink'
    option variant 'mt7628'
    option country 'TW'
    option hwmode '11g'
    option htmode 'HT40'
    option channel 'auto'
    option disabled '0'

config wifi-iface 'ap'
    option device 'radio0'
    option mode 'ap'
    option network 'lan'
    option ifname 'ra0'
    option encryption 'none'
    option ssid 'LinkIt_Smart_7688_23C333'
    option seq '1'

config wifi-iface 'sta'
    option device 'radio0'
    option mode 'sta'
    option network 'wan'
    option ifname 'apcli0'
    option led 'mediatek:orange:wifi'
    option encryption 'psk2'
    option ssid 'XXXXX'
    option key 'XXXXX'
    option disabled '0'

config wifi-device 'radio1'
    option type 'mac80211'
    option channel '11'
    option hwmode '11g'
    option path 'platform/10300000.wmac'
    option htmode 'HT20'
    option disabled '1'

config wifi-iface 'default_radio1'
    option device 'radio1'
    option network 'lan'
    option mode 'ap'
    option ssid 'OpenWrt'
    option encryption 'none'

ifconfig :

br-lan    Link encap:Ethernet  HWaddr 9C:65:F9:23:A9:CF  
          inet addr:192.168.100.1  Bcast:192.168.100.255  Mask:255.255.255.0
          inet6 addr: fd6b:f1eb:9a25::1/60 Scope:Global
          inet6 addr: fe80::9e65:f9ff:fe23:a9cf/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:336 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 B)  TX bytes:34384 (33.5 KiB)

eth0      Link encap:Ethernet  HWaddr 9C:65:F9:23:C3:33  
          inet6 addr: fe80::9e65:f9ff:fe23:c333/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1425 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:479164 (467.9 KiB)
          Interrupt:5 

eth0.1    Link encap:Ethernet  HWaddr 9C:65:F9:23:A9:CF  
          inet6 addr: fe80::9e65:f9ff:fe23:a9cf/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:29 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 B)  TX bytes:6937 (6.7 KiB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:5952 errors:0 dropped:0 overruns:0 frame:0
          TX packets:5952 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:404736 (395.2 KiB)  TX bytes:404736 (395.2 KiB)

ra0       Link encap:Ethernet  HWaddr 9C:65:F9:23:C3:33  
          inet6 addr: fe80::9e65:f9ff:fe23:c333/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:78158 errors:0 dropped:0 overruns:0 frame:0
          TX packets:5995 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:16156893 (15.4 MiB)  TX bytes:0 (0.0 B)
          Interrupt:6

我正在寻找一种学习和实现这一点的方法。要么是没有好的文档,要么是我根本就不明白我在读什么。任何帮助/评论/建议都将不胜感激。

答案1

我找到了自己的解决方案。我只需要向 /etc/config/network 添加一个接口,并根据它配置 /etc/config/wireless。

我补充说;

/etc/config/network
config 'wan2'
     option proto 'dhcp'

并配置;

/etc/config/wireless
config wifi-iface 'sta'
    option device 'radio0'
    option mode 'sta'
    option network 'wan2'
    option ifname 'apcli0'
    option led 'mediatek:orange:wifi'
    option encryption 'psk2'
    option ssid 'XXXXX'
    option key 'XXXXX'
    option disabled '0'

相关内容