Making ethernet as primary connectivity



  • Re: Help getting Ethernet configuration correct [resolved]

    Hi everyone,
    For my project i am using Omega2+ where i need to have Ethernet and WIFI both connectivity, but ethernet as primary.

    I had used ethernet Jack, soldered on general dot matrix pcb with all resistor and capacitor as described in ethernet expansion schematic. I tested ethernet, its working good.

    My objective is to run python MQTT publish and subscribe on available network (WIFI-Ethernet) at any point. Where Ethernet need to give 1st preference if both Ethernet and WIFI are available.

    Problem i am facing is auto switching between network( Ethernet - WIFI ) not happening. There are different cases which i came across:

    1. If i keep Ethernet during boot, then omega gets IP through DHCP form router and MQTT working fine.
    2. Same if keep only WIFI, omega gets IP and MQTT works fine.
    3. But if omega booted with active wifi network , and then if i had connected ethernet and disconnected WIFI by turning off SSID. MQTT does not work, even though omega got IP with ethernet.

    Kindly explain how i can configure network on Omega2 so that both Ethenet and WIFI should work with auto switching between available active network (ethernet and wifi). And giving ethernet as primary network



  • @Suman-kumar-Jha Take a look at hotplug system, if I want to prioritise one interface over another, you can customise those scripts to achieve your goals.

    Scripts are in /etc/hotplug.d/



  • Thanks crispyoz, for the response. Can you guide me in detail. I am new to this.

    My ethernet and WIFI both working, but switching of network between Ethernet and WIFI does not work. I feel always omega is looking for WIFI network only.

    Most of the time i feel ethernet does not getting registered. Please look below image

    0_1567161990832_omega2_ethernet_error.jpeg

    Sometime , if ethernet got registered (checked in ifconfig) but omega does not takes that network. It keeps looking for WIFI

    Please response soon
    Regards
    Suman



  • @Suman-kumar-Jha I'm not entirely clear on what you are trying to achieve.



  • @Suman-kumar-Jha said in Making ethernet as primary connectivity:

    Kindly explain how i can configure network on Omega2 so that both Ethenet and WIFI should work with auto switching between available active network (ethernet and wifi). And giving ethernet as primary network

    I want to achieve auto selection of available active network between WIFI and Ethernet, with Ethernet on 1st priority if both network available.

    I was trying to get Ethernet working, but facing issue. Above picture shows that Omega2+ keep trying to setup Ethernet but fails and keep repeating it

    I think now it is clear, kindly support.

    As i said i am new to the linux environment, so please explain in detail how i can make out.

    Thanks



  • @Suman-kumar-Jha As with any issue it is best to break it down into small parts:

    Step 1, if you disable wifi, does the ethernet device reliably connect, remain connected and function correctly.

    Step 2) if you enable wifi does this have an impact upon the functionalty of the ethernet.

    Depending on the answer to these two questions you will decide how best to proceed.



  • Thanks, I did as you said. Disabled wireless station mode by going into /etc/config/wireless and rebooted.

    After that i tested ethernet plugging and un-plugging many times. Its work and getting identified by omega and registered. Also ping test work. you can see below image

    0_1567234714546_f6c4cf1f-caad-4b45-86eb-e2788d5eebe0-image.png

    But after enabling WIFI :

    1. I rebooted Omega with Ethernet connected, then did ping test it was good working.
    2. After this connected Omega with WIFI also, at this point omega was having both ethernet and WIFI network. Then did ping test again i saw response time got increased. From here i discovered that omega is talking through WIFI not ethernet.
    3. Then i disconnected WIFI and keeping ethernet as it is, and found ping test not working.
      which i feel because Omega is searching WIFI only.

    How i can change network priority between Ethernet and WIFI. Ethernet need to be at 1st priority. WIFI needed just as fallback network, If ethernet not working then search for WIFI

    Please response soon, what i should do next
    Thanks



  • @Suman-kumar-Jha I think the easiest option will be to set a static ip on eth0, then allow the other interface (probabably apcli0) use dhcp.

    I don't know any way to set a priority on an interface on OpenWrt, but you could achieve something like this via a hotplug script on interface up and down etc, but a static ip is a much easier method if that will work for your specific task.

    If you look in /etc/config/network you can set the options on your interface eth0, you can see which options to set by looking at wlan setup.



  • But static IP i can't use it.

    ok crispyoz can you tell me if ethernet is active (got IP, pinging works), why omega2 does not go back to ethernet when wifi is disconnected ?



  • @Suman-kumar-Jha My sense is you are quite inexperienced in this field so I will give you advice and some guidance.

    1. My advice
      If you always ask someone else to give you a solution, then you might solve your problem more quickly but you'll always have a lot of problems. If you ask for guidance on how to come to a solution then your solution will be arrived at with a whole lot of learning along the way.

    2. My guidance

    When an interface comes up or goes down, this hotplug script is executed:

    /etc/hotplug.d/iface/00-netstate

    Spend some time reading up on the hotplug infrastructure and you can find your solution. It's just a scripting system that is triggered whenever an interface (or other device) comes up of goes down (or other relevant action). So think of it as a see-saw, if if1 comes up, execute if2 down, if if2 comes up execute if1 down.

    Don't be daunted by the fact that someone more experienced wrote the exiting script, it was designed to be generic. You need something a bit different, so just write it.



  • crispyoz Thank you for the response.

    Yes i am new to this field accepted. Does Omega is for only experienced person ? please tell me.

    Don't judge me just because i asked you for the help, and listen one more thing till now what ever solution i got from Omega community it was never end to end or complete guideline.
    But then also i made good progress on Omega2 by just getting suggestions. I had done mosquitto MQTT and SSL, python based MQTT and SSL. Made SSL with AWS in python and lot more. This all i created. No body from Omega community given ready made code.

    I have read almost all post related to my problem on Omega community. From last 3 months i am reading and trying everything. I tried Linkit 7688 then dragino YUN and then started on Omega2.
    Don't ever think that i am sitting and asking everything from Omega team.

    If you don't want to give response, its ok. But don't say this things


  • administrators

    @Suman-kumar-Jha This thread on the OpenWRT forums seems to cover this same topic - setting the ethernet interface as the default route:
    https://forum.openwrt.org/t/default-route-is-always-wlan0/10548

    Try it out and let us know how it goes



Looks like your connection to Community was lost, please wait while we try to reconnect.