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....
Auto-connect to ethernet doesn't work
Re: Auto-connect to ethernet doesn't work
If you are using NetworkManager then it ought to just reconnect automatically.
When it's NOT working, what is the output from systemctl -l status NetworkManager network
Does nmcli conn up $interfaqce help? Or ifup $interface?
When it's NOT working, what is the output from systemctl -l status NetworkManager network
Does nmcli conn up $interfaqce help? Or ifup $interface?
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke
Re: Auto-connect to ethernet doesn't work
Ah.
nmcli conn up $interfaqce
Is exactly what I need. If the connection is down for whatever reason, this reconnects it. Exactly the behavior I need.
I'm not sure why the auto-connect didn't work - it may be because it's not a dhcp connection but a static one (hardware reason on the other drive make it a constraint).
At any rate, you command works - thanks a bunch. You wouldn't believe how much I search for that on forums (but all I came up with was more along the lines of ip link set & equivalent). Not sure if I just had the wrong keyword or what - thanks anyways.
nmcli conn up $interfaqce
Is exactly what I need. If the connection is down for whatever reason, this reconnects it. Exactly the behavior I need.
I'm not sure why the auto-connect didn't work - it may be because it's not a dhcp connection but a static one (hardware reason on the other drive make it a constraint).
At any rate, you command works - thanks a bunch. You wouldn't believe how much I search for that on forums (but all I came up with was more along the lines of ip link set & equivalent). Not sure if I just had the wrong keyword or what - thanks anyways.