2699|0

3836

帖子

19

TA的资源

纯净的硅(中级)

楼主
 

x86入门之第一章,连接 [复制链接]

本帖最后由 paulhyde 于 2014-9-15 08:56 编辑

  1. Chapter 1
  2. The Router
  3. 1.1 Getting started
  4. 1.1.1 Installation
  5. 1.1.2 Initial configuration
  6. 1.1.3 Failsafe mode
  7. 1.2 Configuring OpenWrt
  8. 1.2.1 Network
  9. The network configuration in Kamikaze is stored in /etc/config/network and is divided into interface configurations. Each interface configuration either refers directly to an ethernet/wifi interface (eth0, wl0, ..) or to a bridge containing multiple interfaces. It looks like this:
  10. config interface "lan"
  11. option ifname "eth0"
  12. option proto "static"
  13. option ipaddr "192.168.1.1"
  14. option netmask "255.255.255.0"
  15. option gateway "192.168.1.254"
  16. option dns "192.168.1.254"
  17. ifname specifies the Linux interface name. If you want to use bridging on one or more interfaces, set ifname to a list of interfaces and add:
  18. option type "bridge"
  19. It is possible to use VLAN tagging on an interface simply by adding the VLAN IDs to it, e.g. eth0.1. These can be nested as well.
  20. This sets up a simple static configuration for eth0. proto specifies the protocol used for the interface. The default image usually provides ’none’ ’static’, ’dhcp’ and ’pppoe’. Others can be added by installing additional packages.
  21. When using the ’static’ method like in the example, the options ipaddr and netmask are mandatory, while gateway and dns are optional. You can specify more than one DNS server, separated with spaces.
  22. DHCP currently only accepts ipaddr (IP address to request from the server) and hostname (client hostname identify as) - both are optional.
  23. PPP based protocols (pppoe, pptp, ...) accept these options:
  24. * username
  25. The PPP username (usually with PAP authentication)
  26. * password
  27. The PPP password
  28. * keepalive
  29. Ping the PPP server (using LCP). The value of this option specifies the maximum number of failed pings before reconnecting. The ping interval defaults to 5, but can be changed by appending "," to the keepalive value
  30. * demand
  31. Use Dial on Demand (value specifies the maximum idle time.
  32. * server: (pptp)
  33. The remote pptp server IP
  34. For all protocol types, you can also specify the MTU by using the mtu option.
  35. Setting up static routes
  36. You can set up static routes for a specific interface that will be brought up after the interface is configured.
  37. Simply add a config section like this:
  38. config route foo
  39. option interface lan
  40. option target 1.1.1.0
  41. option netmask 255.255.255.0
  42. option gateway 192.168.1.1
  43. The name for the route section is optional, the interface, target and gateway options are mandatory. Leaving out the netmask option will turn the route into a host route.
  44. Setting up the switch (currently broadcom only)
  45. The switch configuration is set by adding a ’switch’ config section. Example:
  46. config switch "eth0"
  47. option vlan0 "1 2 3 4 5*"
  48. option vlan1 "0 5"
  49. On Broadcom hardware the section name needs to be eth0, as the switch driver does not detect the switch on any other physical device. Every vlan option needs to have the name vlan where is the VLAN number as used in the switch driver. As value it takes a list of ports with these optional suffixes:
  50. * ’*’: Set the default VLAN (PVID) of the Port to the current VLAN
  51. * ’u’: Force the port to be untagged
  52. * ’t’: Force the port to be tagged
  53. The CPU port defaults to tagged, all other ports to untagged. On Broadcom hardware the CPU port is always 5. The other ports may vary with different hardware.
  54. For instance, if you wish to have 3 vlans, like one 3-port switch, 1 port in a DMZ, and another one as your WAN interface, use the following configuration :
  55. config switch "eth0"
  56. option vlan0 "1 2 3 5*"
  57. option vlan1 "0 5"
  58. option vlan2 "4 5"
  59. Three interfaces will be automatically created using this switch layout : eth0.0 (vlan0), eth0.1 (vlan1) and eth0.2 (vlan2). You can then assign those interfaces to a custom network configuration name like lan, wan or dmz for instance.
  60. Setting up IPv6 connectivity
  61. OpenWrt supports IPv6 connectivity using PPP, Tunnel brokers or static assignment.
  62. If you use PPP, IPv6 will be setup using IP6CP and there is nothing to configure.
  63. To setup an IPv6 tunnel to a tunnel broker, you can install the 6scripts package and edit the /etc/config/6tunnel file and change the settings accordingly :
  64. config 6tunnel
  65. option tnlifname ’sixbone’
  66. option remoteip4 ’1.0.0.1’
  67. option localip4 ’1.0.0.2’
  68. option localip6 ’2001::DEAD::BEEF::1’
  69. option prefix ’/64’
  70. * ’tnlifname’: Set the interface name of the IPv6 in IPv4 tunnel
  71. * ’remoteip4’: IP address of the remote end to establish the 6in4 tunnel. This address is given by the tunnel broker
  72. * ’localip4’: IP address of your router to establish the 6in4 tunnel. It will usually match your WAN IP address.
  73. * ’localip6’: IPv6 address to setup on your tunnel side This address is given by the tunnel broker
  74. * ’prefix’: IPv6 prefix to setup on the LAN.
  75. Using the same package you can also setup an IPv6 bridged connection :
  76. config 6bridge
  77. option bridge ’br6’
  78. By default the script bridges the WAN interface with the LAN interface and uses ebtables to filter anything that is not IPv6 on the bridge.
  79. IPv6 static addressing is also supported using a similar setup as IPv4 but with the ip6 prefixing (when applicable).
  80. config interface "lan"
  81. option ifname "eth0"
  82. option proto "static"
  83. option ip6addr "fe80::200:ff:fe00:0/64"
  84. option ip6gw "2001::DEAF:BEE:1"
复制代码
by 南京老练

 

此帖出自电子竞赛论坛
点赞 关注
 
 

回复
举报
您需要登录后才可以回帖 登录 | 注册

随便看看
查找数据手册?

EEWorld Datasheet 技术支持

相关文章 更多>>
关闭
站长推荐上一条 1/8 下一条
ADI &文晔 探索季第一站,邀您在活动帖跟帖,ADI资深工程师将与您一道寻求解决之道! ...
春晚,最出圈当属穿着棉马甲跳秧歌的机器人”秧Bot”。
转手绢、飞手绢、变换队形,精准度和稳定性甚至超越人类,这背后少不了电机控制技术。

查看 »

 
EEWorld订阅号

 
EEWorld服务号

 
汽车开发圈

 
机器人开发圈

About Us 关于我们 客户服务 联系方式 器件索引 网站地图 最新更新 手机版

站点相关: 国产芯 安防电子 汽车电子 手机便携 工业控制 家用电子 医疗电子 测试测量 网络通信 物联网

北京市海淀区中关村大街18号B座15层1530室 电话:(010)82350740 邮编:100190

电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2025 EEWORLD.com.cn, Inc. All rights reserved
快速回复 返回顶部 返回列表