Auto-connect to ethernet doesn't work
Posted: 2019/06/07 14:55:22
Hey,
I have a server with 2 ethernet connection. One used for internet access (not the one of concern here),em1. I also have em2 which is used to talk to a hardware driver through ethernet.
I need that to always be on, and in case where it isn't I need that to reconnect. So i have a bash script who's job it is to monitor that. I check through ip route show that em2 is connect. That works fine.
When ip route tells me em2 is off, then.... Well I haven't found a way to emulate through terminal the same command that happens if I click on the network manager (in the GUI), select 'em2' and then click 'Connect' (which is what my script is supposed to do, ideally). So I have setup autoconnect on em2 and I'm thinking I can just shut down the interface & up again with:
ip link set down em2
(wait)
ip link set up em2
This works fine as long as the drive was connected before it was shut down. So it's kinda useless.
Yes, I have used nmtui to set it up to auto-connect. And yes, grep ONBOOT /etc/sysconfig/network-scripts/ifcfg-* tells me everything (even non-relevent connections) are ONBOOT='yes'.
So basically I need either a way to make auto-connect actually work, or a command to do the equivalent of em2 ---> Connect.
Thanks....
I have a server with 2 ethernet connection. One used for internet access (not the one of concern here),em1. I also have em2 which is used to talk to a hardware driver through ethernet.
I need that to always be on, and in case where it isn't I need that to reconnect. So i have a bash script who's job it is to monitor that. I check through ip route show that em2 is connect. That works fine.
When ip route tells me em2 is off, then.... Well I haven't found a way to emulate through terminal the same command that happens if I click on the network manager (in the GUI), select 'em2' and then click 'Connect' (which is what my script is supposed to do, ideally). So I have setup autoconnect on em2 and I'm thinking I can just shut down the interface & up again with:
ip link set down em2
(wait)
ip link set up em2
This works fine as long as the drive was connected before it was shut down. So it's kinda useless.
Yes, I have used nmtui to set it up to auto-connect. And yes, grep ONBOOT /etc/sysconfig/network-scripts/ifcfg-* tells me everything (even non-relevent connections) are ONBOOT='yes'.
So basically I need either a way to make auto-connect actually work, or a command to do the equivalent of em2 ---> Connect.
Thanks....