I have the file /etc/udev/rules.d/70-persistent-net.rules
that have such interfaces:
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="1c:af:f7:e7:a4:3c", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="78:e3:b5:43:47:ad", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
I want to replace eth0
with eth1
and vice versa, tried to do with the sed command without success:
sed -i 's|eth0|eth1|g'
It switches eth0
to eth1
obviously but now I have 2 eth1
interfaces.
I wanted a command that "switches" the place strings to get this result:
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="1c:af:f7:e7:a4:3c", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="78:e3:b5:43:47:ad", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"