--- title: Change Ethernet config ref: ethernet_config lang: en fontawesome_icon: fa-ethernet --- == WAN port configuration The recommended `lime-hwd-openwrt-wan` package detects the WAN port and configures it for getting connectivity to the internet. === Connecting via SSH also from the WAN port If the OpenWrt's firewall is present, it will block incoming connections on the WAN port, for security reasons. If you need to connect via SSH from the WAN port (likely from the internet), you can allow the incoming connection to the port 22 (the default port for SSH) adding these lines in `/etc/config/firewall` and rebooting your router: ---- config rule option name 'Allow-SSH' option src 'wan' option proto 'tcp' option dest_port '22' option target 'ACCEPT' ---- === Using the WAN port for connecting with another cloud When two neighboring LibreMesh networks want to interconnect without flooding each other with local broadcast traffic, they use two different WiFi access point names `ap_name`. But if they want to do the same via cable, they can do so with a WAN-WAN connection, connecting two border nodes via their WAN ports. This is absolutely not the intended use for a WAN port but works. Important: if you have the OpenWrt firewall installed, you will need to allow all the incoming connections on the WAN port of both border routers. For doing this, edit the `/etc/config/firewall` file like this and reboot your routers: ---- config zone option name wan list network 'wan' list network 'wan6' option input REJECT --> change to ACCEPT option output ACCEPT option forward REJECT --> change to ACCEPT option masq 1 option mtu_fix 1 ---- == LibreMesh interface-specific network configuration If no interface-specific network configuration is present, the general network configuration section is used for all the interfaces. For more information about the general LibreMesh config file options see link:en_config.html[The config file] page. For more examples and offline documentation check out `/docs/lime-example.txt` or http://thisnode.info/docs/lime-example.txt on the router or https://github.com/libremesh/lime-packages/blob/master/packages/lime-docs/files/www/docs/lime-example.txt[lime-example file online]. == Specific ethernet interface configuration If we want to change the default behavior of just one network interface of the many that are present in a router, we can define a specific configuration. Please make sure to check out how OpenWrt names the physical ports of your router model, for this read the router page accessible from https://openwrt.org/toh/start[OpenWrt table of hardware]. .Ethernet specific options, multiple allowed ---- config net port5 option linux_name 'eth1.5' list protocols 'wan' ---- In this case the eth1.5 interface will be used as WAN (so the DHCP client will be enabled). [NOTE] .config net ================ Do not put any "." in the section name (e.g. _port5_). As `linux_name`, use the actual name of the interface as the system shows (check with +ip link show+). Some of the available protocols require the relative package, for example `lime-proto-wan`, to be installed. ================ [NOTE] .Network interface specific options ======================= Available protocols: bmx6, bmx7, batadv, olsr, olsr6, olsr2, bgp, wan, lan, manual, static, babeld, apbb, client Note that some of these protocols will require the relative `lime-proto-...` package being installed, otherwise the protocol entry will be ignored. proto:vlan_number works too (something like bmx6:13 is supported). If VLAN is 0, no VLAN will be used. VLAN type defaults to 802.1ad, but it can be set to 80.1q adding another option `proto:vlan_number:8021q`. If you use manual do not specify other protocols, may result in an unpredictable behavior/configuration. ======================= [NOTE] .WAN autoconfiguration ================= If the LibreMesh package `lime-hwd-openwrt-wan` is installed and your node have two or more ethernet ports, LibreMesh might autoconfigure as WAN one of these network ethernet device. In this case you will find a new specific configuration section like this one: ---- config net 'lm_hwd_openwrt_wan' option autogenerated 'true' ... ---- If we want to change the behavior of this specific network interface and stop the automatic rewrite of its configuration, we must set the `autogenerated` option to `false`. ================= == Ground routing configuration For more information on ground routing concept, check out https://github.com/libremesh/lime-packages/issues/443[these resources]. .Ground routing specific sections ---- config hwd_gr link1 option net_dev 'eth0' option vlan '5' option switch_dev 'switch0' option switch_cpu_port '0' list switch_ports '4' ---- [NOTE] .config hwd_gr =============== * net_dev: Plain ethernet device on top of which 802.1q VLAN will be constructed. * vlan: VLAN ID to use for this ground routing link, use little one because cheap switch doesn't supports big IDs, this will be used also as 802.1q VID. * switch_dev: These options regarding switch need to be set only if your ethernet device is connected to a switch chip. If the switch exists you can read its name (like switch0) in +/etc/config/network+ file. * switch_cpu_port: Refer to switch port map of your device on https://openwrt.org/toh/start[OpenWrt ToH] to know CPU port index. * switch_ports: List switch ports on which you want the VLAN being passed, refer to https://openwrt.org/toh/start[OpenWrt ToH] for correspondence with physical ports. =============== [NOTE] ============== One section for each ground routing link. With ground routing we mean setups having LibreMesh on a router which is connected via cable(s), eventually through a switch, to some wireless routers running the original firmware in WDS (transparent bridge) Ap/Sta mode. Likely you want to configure as many sections of ground routing with different VLAN numbers or different switch ports as many connected devices in WDS mode. ============== == BGP configuration .Proto BGP specific sections (one section for each BGP peer) ---- config bgp_peer peer1 option remoteIP '192.0.2.6' option remoteAS '65550' config bgp_peer peer2 option remoteIP '2001:db8::c001' option remoteAS '65549' ---- For documentation on BGP configuration see link:http://nicolasacco.diveni.re/~gio/internship-report/main.html#proto:bgp[this thesis].