Narkozzz Posted August 18, 2015 Posted August 18, 2015 Hello, just installed R1 image, solved power issues as described on this forum and now trying to configure it as classic home router. So I got a problem configuring DHCP server - system works in interfaces.r1 mode that means lan and wlan are bridged to wan. Wlan and Lan interfaces configured as manual that is not very handy, so I need to install DHCP server and make some NAT. And here goes a problem - I am not very skilled in linux networking and cant figure out how to combine NAT and R1 interfaces to get classical router behavior (externalDHCP-WAN-NAT192.168.0.1-internal DHCP-LAN and WLAN DHCP clients). Can someone give me directions? Maybe there is a way to install something like OpenWRT web-server where you can operate router's functions?
tkaiser Posted August 18, 2015 Posted August 18, 2015 The only OpenWRT image recommended can be found here: http://www.bananapi.com/index.php/forum/general/1157-openwrt-chaos-calmer-3rd-test-version-gigabit-and-temp-sensors-10-08-15?limitstart=0 If you still want to go the Armbian route (recommended if you want to learn to improve your skills) then start with Tido's tutorial. 1
db260179 Posted August 18, 2015 Posted August 18, 2015 I've updated the image. Feedback is welcome. Can someone post their kernel log. Thanks 1
Narkozzz Posted August 19, 2015 Author Posted August 19, 2015 tkaiserThank you! Great manual, only one thing is missing - DHCP clients on LAN and WLAN interfaces have no routing to internet, trying to find out where is the problem.
tkaiser Posted August 19, 2015 Posted August 19, 2015 I believe I don't get your setup. Is there an external DHCP server behind the WAN interface or should the R1 play both NAT router, DHCP server (and of course caching DNS server)? If it's the latter I would do a web search for "dnsmasq nat howto": basically dnsmasq will serve dhcp/dns purposes and the NAT stuff will be handled by uncommenting 'net.ipv4.ip_forward=1' in /etc/sysctl.conf amd the iptables stuff taken from Tido's manual. But maybe the whole thing is already covered by Tido in his manual...
petrmaje Posted August 19, 2015 Posted August 19, 2015 If you want to play, try to configure armbian as router. But the db260179's OpenWrt, which Tkaiser pointed, is really on the right way to be stable powerful system for routing. Try it and you will see the power or R1 You can play easily with VLANs, several clicks and you have NAS, torrent.... Do you want backup network connection via LTE USB modem? One minute and everything works Statistics? Graphs? No problem. The only thing is, that you need your own www server, where you store opkg repository. It can be complication, but when I will have my public IP back, you can download from my Lamobo with armbian Hello, just installed R1 image, solved power issues as described on this forum and now trying to configure it as classic home router. So I got a problem configuring DHCP server - system works in interfaces.r1 mode that means lan and wlan are bridged to wan. Wlan and Lan interfaces configured as manual that is not very handy, so I need to install DHCP server and make some NAT. And here goes a problem - I am not very skilled in linux networking and cant figure out how to combine NAT and R1 interfaces to get classical router behavior (externalDHCP-WAN-NAT192.168.0.1-internal DHCP-LAN and WLAN DHCP clients). Can someone give me directions? Maybe there is a way to install something like OpenWRT web-server where you can operate router's functions?
Narkozzz Posted August 19, 2015 Author Posted August 19, 2015 tkaiserI am solved this issue and made correction to manual - it was about 1 line in DHCP config - router was not defined (in manual it is 192.168.9.2) petrmajeRouter part is the only one purpose I plan to use this board. There also will be asterisk PBX, IPSEC tunneling, squid proxy and webserver
petrmaje Posted August 19, 2015 Posted August 19, 2015 All of these packages are also available in OpenWrt :-) (and probably with web LuCi interface) But I understand, that armbian is real linux. Same like me, I don't want to have apache under OpenWrt .... tkaiser I am solved this issue and made correction to manual - it was about 1 line in DHCP config - router was not defined (in manual it is 192.168.9.2) petrmajeRouter part is the only one purpose I plan to use this board. There also will be asterisk PBX, IPSEC tunneling, squid proxy and webserver
Tido Posted August 19, 2015 Posted August 19, 2015 I am solved this issue and made correction to manual - it was about 1 line in DHCP config - router was not defined (in manual it is 192.168.9.2) Hi, Concerning the setup, on page 5 I wrote: connect the single WAN port to your current Router. So the router is in this scenario not directly connected to the cablemodem /DSL. If I think now, my comments in 'interfaces' lead to this assumption for eth0.101 I will have to review that and think /test changes. Thank you 1
Narkozzz Posted August 20, 2015 Author Posted August 20, 2015 Hello, Tido! In my scenario R1 was also inside local network, but the issue is not about it. DHCP clients of R1 got their configuration from dhcpd.conf. In your manual DHCP server was configure to provide only IP and Subnet, so gateway option on clients remained empty and they dont get access to Internet. In your config DHCP-clients are behind R1 NAT and br0 address 192.168.9.2 acts as NAT router. My correction to dhcpd.conf resolved the issue on my setup. Also I want to thank you for great manual! P.S. Also it is good idea to add a line to dhcpd.conf with option domain-name-servers 8.8.8.8; to provide DNS config to DHCP clients as well.
cfi700 Posted September 4, 2015 Posted September 4, 2015 Hello, after several try's to get my BPi R1 working as a router (according to Tido's manual) i have no success. I want to use the Bpi R1 as a DHCP-Server in a separate network bridged to my local network over the BPi's WAN-Port. On the BPi also run's the Mosquitto MQTT-Server for my home-automation network (IOT). So my question is: Is there please anybody out there with a running router setup and could share the image? Best regard, Christian
tkaiser Posted September 4, 2015 Posted September 4, 2015 I want to use the Bpi R1 as a DHCP-Server in a separate network bridged to my local network over the BPi's WAN-Port. [...] router setup You're talking about two different things :-) Routing is not bridging. In short words: Unless you get a clue what you really want to do you won't succeed. If you want the R1 to act as a bridge between your LAN and the devices connected to the R1's so called "LAN ports" then all you've to do is to setup one VLAN connecting all 6 ports (SoC and the 5 external ports) and you're done (since then the R1 acts as a switch which is nothing more or less than a multi-port bridge). In this case it's a really bad idea to setup a DHCP server on the R1 unless it has absolutely the same config as the already present DHCP server in your LAN. Igor ships already such a config, all you've to do is a "ln -sf /etc/network/interfaces.r1switch /etc/network/interfaces && reboot" I suppose you want a NAT/router setup instead? In this case you use 2 different VLANs, one for the so called 'WAN port' that is connected to your LAN and another one connecting all the other ports together to work in switch mode. Again: Igor ships such a config already: https://github.com/igorpecovnik/lib/blob/next/config/interfaces.r1(should be the default) And then you set up DHCP (I would prefer dnsmasq for this task) and in case the devices connected to the R1's LAN ports should be able to reach your LAN behind the 'WAN port' you would setup NAT also. If you do a google search for "debian nat dnsmasq" or something like that you get tons of tutorials. All you've take care of is that your external interface is eth0.101 and the 'internal' eth0.102 instead. And if you don't want to use the R1's Wi-Fi you would've to remove the br0 definition in the interfaces file and adjust settings (static settings for eth0.102 and eth0.101 getting an address via the DHCP server in your real LAN for example)
cfi700 Posted September 4, 2015 Posted September 4, 2015 @tkaiser Thank you for your quick answer. For more clearness i added a picture of the network architecture to drive my home automation system. PS: I tried also the openwrt image from db260179, but there is no change (for me) to install the Mosqitto-Package without a own Package-server !?! Tests with the Raspberry Pi and Mosqitto are working well, but without a separate network for the automation part. So i decide to use the BPi R1 to separate the traffic between the "normal" Network and the IOT-Network.
tkaiser Posted September 4, 2015 Posted September 4, 2015 Ok, so now I would assume that you neither want bridging nor NAT but simple routing instead. Since the onboard Wi-Fi is crappy I wouldn't use it. Then you end up with something like: auto lo iface lo inet loopback auto eth0.101 iface eth0.101 inet dhcp pre-up swconfig dev eth0 set reset 1 pre-up swconfig dev eth0 set enable_vlan 1 pre-up swconfig dev eth0 vlan 101 set ports '3 8t' pre-up swconfig dev eth0 set apply 1 auto eth0.102 iface eth0.102 inet manual pre-up swconfig dev eth0 vlan 102 set ports '0 1 2 4 8t' pre-up swconfig dev eth0 set apply 1 address 192.168.2.1 netmask 255.255.255.0 network 192.168.0.0 broadcast 192.168.2.255 You would've to add an IP configuration for the eth0.102 entry (different subnet as in your LAN! If you use there 192.168.1.0/24 for example then use 192.168.2.0/24 as in the example above) and then you install dnsmasq and configure it to be active only on eth0.102. If clients in both nets should be able to talk to each other (routing between WAN and LAN VLANs on the R1) then you do sysctl net.ipv4.ip_forward=1 echo "net.ipv4.ip_forward=1" >>/etc/sysctl.conf If the devices on R1's LAN ports should also be able to reach the internet then there's more to do. But I would configure dnsmasq as a simple DNS forwarder and that's it. Mosqitto running on the R1 is able to talk to all connected devices in any case.
cfi700 Posted September 4, 2015 Posted September 4, 2015 @tkaiser: Unfortunately, I'm not a Linux specialist who know for what these entries are be necessary to get a working system. But I am surprised that there is no ready router system for the R1-Hardware. My skill's ending by installing a simple package (Mosqitto) and configure some settings. For me it is easier to program microcontrollers in C (IOT Clients) than fiddling thousands of configuration files in a Linux system. So please, could you provide a running image of a "simple" router-system with the ability to add some more standard packages (in my special case Mosqitto). I even would donate money for your work too. PS: Sorry for my english
petrmaje Posted September 4, 2015 Posted September 4, 2015 @tkaiser: Unfortunately, I'm not a Linux specialist who know for what these entries are be necessary to get a working system. But I am surprised that there is no ready router system for the R1-Hardware. My skill's ending by installing a simple package (Mosqitto) and configure some settings. For me it is easier to program microcontrollers in C (IOT Clients) than fiddling thousands of configuration files in a Linux system. So please, could you provide a running image of a "simple" router-system with the ability to add some more standard packages (in my special case Mosqitto). I even would donate money for your work too. PS: Sorry for my english Hi, to solve this with dnsmasq is very easy. You dont need any complex manual for router, if you need just one WAN and four LANs, follow tkaiser's configuration of /etc/network/interfaces. Reboot. Then install dnsmasq (apt-get install dnsmasq). Then edit /etc/dnsmasq.conf and put there this: dhcp-authoritative domain-needed localise-queries read-ethers bogus-priv expand-hosts local-service domain=lan server=/lan/ dhcp-range=eth0.102,192.168.2.2,192.168.2.100,255.255.255.0,10m no-dhcp-interface=eth0.101 Reboot. Everything should work. I find small mistake, correct line in /etc/network/interfaces this line network 192.168.2.0 But you can ommit this line. This should work! PM
cfi700 Posted September 5, 2015 Posted September 5, 2015 Hello and good morning.. I tried all your suggestions on an new armbian (Debian-wheezy 4.1.6) system and getthis error on starting the system (see Image): In the interfaces config I only changed the subnet from 2 to 33: address 192.168.33.250 netmask 255.255.255.0network 192.168.33.0broadcast 192.168.33.255 In dnsmasq config I changed: dhcp-range=eth0.102,192.168.33.100,192.168.33.200,255.255.255.0,10m In dnsmasq i have to disable the "local-service" switch -> bad option error on start up (I think this depends on the 4.1.6 Version ?) Regards, Christian
petrmaje Posted September 5, 2015 Posted September 5, 2015 Hello and good morning.. I tried all your suggestions on an new armbian (Debian-wheezy 4.1.6) system and getthis error on starting the system (see Image): In the interfaces config I only changed the subnet from 2 to 33: address 192.168.33.250 netmask 255.255.255.0 network 192.168.33.0 broadcast 192.168.33.255 In dnsmasq config I changed: dhcp-range=eth0.102,192.168.33.100,192.168.33.200,255.255.255.0,10m In dnsmasq i have to disable the "local-service" switch -> bad option error on start up (I think this depends on the 4.1.6 Version ?) Regards, Christian If there is bad option, simply ommit the option I tried this long time before, and as I see this error.... Try default /etc/network/interfaces, where lan is br0. Ommit no-dhcp-interface line and modify dhcp-range=br0, ......
cfi700 Posted September 5, 2015 Posted September 5, 2015 If there is bad option, simply ommit the option I tried this long time before, and as I see this error.... Try default /etc/network/interfaces, where lan is br0. Ommit no-dhcp-interface line and modify dhcp-range=br0, ...... Many thanks for your quick reply. Could you please show me more details on how to set lan is br0 in the interface config. The changes in dnsmasq you suggested are done.
petrmaje Posted September 5, 2015 Posted September 5, 2015 Many thanks for your quick reply. Could you please show me more details on how to set lan is br0 in the interface config. The changes in dnsmasq you suggested are done. auto lo iface lo inet loopback auto eth0.101 iface eth0.101 inet dhcp pre-up swconfig dev eth0 set reset 1 pre-up swconfig dev eth0 set enable_vlan 1 pre-up swconfig dev eth0 vlan 101 set ports '3 8t' pre-up swconfig dev eth0 set apply 1 auto eth0.102 iface eth0.102 inet manual pre-up swconfig dev eth0 vlan 102 set ports '0 1 2 4 8t' pre-up swconfig dev eth0 set apply 1 auto br0 iface br0 inet static address 192.168.2.1 netmask 255.255.255.0 network 192.168.2.0 broadcast 192.168.2.255 bridge_ports eth0.102
cfi700 Posted September 5, 2015 Posted September 5, 2015 @petrmaje: You are the best! Now, the BPi R1 working as expected. But... i have two more little problems: First is there a easy way to disable the WLAN? (not so tragic if not) Second, maybe more complicated - For some of my IOT-Clients I need a static IP-Address (connect to MAC). Could I do this as well in one of the configuration files and could you give me some hints?
petrmaje Posted September 5, 2015 Posted September 5, 2015 @petrmaje: You are the best! Now, the BPi R1 working as expected. But... i have two more little problems: First is there a easy way to disable the WLAN? (not so tragic if not) Second, maybe more complicated - For some of my IOT-Clients I need a static IP-Address (connect to MAC). Could I do this as well in one of the configuration files and could you give me some hints? service hostapd stop update-rc.d hostapd disable For static DHCP leseases simply add line like this to dnsmasq.conf : dhcp-host=02:05:05:02:d3:84,10.0.0.220
cfi700 Posted September 5, 2015 Posted September 5, 2015 Now all things are working -> Great Job: @petrmaje, @tkaiser 1
Wolf2000 Posted September 26, 2015 Posted September 26, 2015 Kann mir jemand helfen! ich habe schon alles ausprobiert von Tido, usw. ich habe das img Armbian_4.2_Lamobo-r1_Debian_wheezy_4.1.6 Mein vorhaben den wan port (3) als internet Eingang, die anderen Ports sind für meine Clienten die au den Board zugreifen können. Gibt es ein img. was funktioniert oder mir sharen kann. Sorry ich kann nicht gut Englisch Ich Danke in voraus
petrmaje Posted September 27, 2015 Posted September 27, 2015 Kann mir jemand helfen! ich habe schon alles ausprobiert von Tido, usw. ich habe das img Armbian_4.2_Lamobo-r1_Debian_wheezy_4.1.6 Mein vorhaben den wan port (3) als internet Eingang, die anderen Ports sind für meine Clienten die au den Board zugreifen können. Gibt es ein img. was funktioniert oder mir sharen kann. Sorry ich kann nicht gut Englisch Ich Danke in voraus You need probably the same configuration as cfi700. So follow his steps in this forum and everything should work.
Tido Posted October 6, 2015 Posted October 6, 2015 In your manual DHCP server was configure to provide only IP and Subnet, so gateway option on clients remained empty and they dont get access to Internet. P.S. Also it is good idea to add a line to dhcpd.conf with option domain-name-servers 8.8.8.8; to provide DNS config to DHCP clients as well. I don't like the idea at all to use GOOGLEs DNS 8.8.8.8 and I know that my setup worked. Usually, your Internet-Service-Provider (like comcast, swisscom, british telecom) will serve you with DNS (domain-name-servers) to get a quick lookup. So without a lot of knowledge I try&error, read and finally found the solution or what I did wrong. I started originally with dnsmasq and at some time I decided to replace it with isc-dhcp because part of it is already installed. In isc-dhcp it directs DNS traffic now to my NETGEAR router which has the Provider DNS in its config. So I have now activated the 'gateway' in the interfaces so that the /etc/resolv.conf also gets this information AND BOOOM it works. Please try and report back.
Recommended Posts