Systemd v197 happened in the meantime and introduced persistent net naming rules https://projects.archlinux.org/svntogit … 0f8bef7edb
I've never used NM, but I think you should read https://wiki.archlinux.org/index.php/Ne … vice_names and https://wiki.archlinux.org/index.php/Ne … i_examples
]]>Gcool wrote:# nmcli con up id <profilename> iface eth0
This works. Thanks.
Sorry for necro, but what to do if I got no existing profile with eth0 connection? Should I just mock one up by creating a file into?
/etc/NetworkManager/system-connections
By doing that networkmanager does not interpret it as a profile. Even when I modify an existing one, networkmanager skips and removes it from the existing connections.
]]># nmcli con up id <profilename> iface eth0
This works. Thanks.
]]># nmcli con up id <profilename> iface eth0
Not 100% if this will do exactly what you want there (don't use networkmanager myself), but it's worth a shot.
]]>So if I understand correctly, you just want eth0 to request an ip again from the dhcp server? You can just run "dhclient eth0" in that case.
No, if I execute the above command, networkmanager will not be the one to do the work & networkmanager will show that's it's not using eth0.
Basically, I want networkmanager to change the state to connected.
]]>Sorry, I misunderstood what you meant by "disabled", and admittedly, did not read your command.
How about:
ip addr flush dev eth0
No, actually the thing is that the act of assigning the ip address is done using networkmanager (dhclient actually) so I have to instruct networkmanager to do that & I can't seem to find a way to do that. There is an option to disconnect but no option to connect.
]]>How about:
ip addr flush dev eth0
ip link set eth0 up
Please not that by disconnecting, it doesn't mean that eth0 goes down. Just the ip is released.
shadyabhi@MBP-archlinux ~ $ ifconfig eth0
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 metric 1
inet 10.100.98.79 netmask 255.255.255.0 broadcast 10.100.98.255
inet6 fe80::cabc:c8ff:fe9b:c43c prefixlen 64 scopeid 0x20<link>
ether c8:bc:c8:9b:c4:3c txqueuelen 1000 (Ethernet)
RX packets 8923 bytes 2653832 (2.5 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1388 bytes 201186 (196.4 KiB)
TX errors 1 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 21
shadyabhi@MBP-archlinux ~ $ nmcli dev disconnect iface eth0
Device state: 30 (disconnected)
shadyabhi@MBP-archlinux ~ $ ifconfig eth0
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 metric 1
inet6 fe80::cabc:c8ff:fe9b:c43c prefixlen 64 scopeid 0x20<link>
ether c8:bc:c8:9b:c4:3c txqueuelen 1000 (Ethernet)
RX packets 9097 bytes 2741613 (2.6 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1394 bytes 201596 (196.8 KiB)
TX errors 1 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 21
shadyabhi@MBP-archlinux ~ $
ip link set eth0 up
]]>${if_up wlan0} wlan0: ${downspeed wlan0}/s | ${goto 810} ${upspeed wlan0}/s ${goto 875}${endif} ${if_up eth0} eth0: ${downspeed eth0}/s ${goto 800} |
I have configured conky such that conditions like ${if_up wlan0} are satisfied only when an interface has an address using
#Strictnes of eth0
if_up_strictness address
in the conkyrc.
Which causes conky to display interface like this. (Only one at a time, never both eth0 and wlan0).
Now, lets suppose I am using eth0 and wlan0 is disabled. I enable wireless and connect to an access point, I have a dispatcher script that changes the state of eth0 to disconnected.
if [ $INTERFACE = "wlan0" ] && [ $STATUS = "up" ];then
nmcli dev disconnect iface eth0
fi
I do this so that IP address of eth0 is released and ${if_up eth0} causes the eth0 part to not being displayed as I only want only the interface I am using to be displayed in conky.
QUESTION: Now, when I disconnect wlan0, I want to make the state of eth0 to be connected again. I have tried looking at the options in nmcli, there is an option under dev to disconnect but no option to revert the effect of disconnect.
]]>