How can I create a virtual interface similar to the following ifconfig
command?
$ sudo ifconfig eth1 hw ether 00:01:02:aa:bb:cc
SIOCSIFHWADDR: No such device
This does not work. I want to set the MAC addresses to test my DHCP server's configuration.
How would I do that with the iproute2
suite using the ip link command?
$ sudo ip link add type veth
This works, but it randomly assigns a MAC address. This is still useful, but I would like to test my dhcpd
server with some specific MAC addresses in order to see how it handles the classes I have set up.
My current setup 1:
$ ip ad
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 60:eb:69:1b:a0:88 brd ff:ff:ff:ff:ff:ff
inet 172.16.0.93/24 brd 172.16.0.255 scope global eth0
inet6 fe80::62eb:69ff:fe1b:a088/64 scope link
valid_lft forever preferred_lft forever
7: vboxnet0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
link/ether 0a:00:27:00:00:00 brd ff:ff:ff:ff:ff:ff
8: veth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
link/ether 3a:50:38:2e:24:c4 brd ff:ff:ff:ff:ff:ff
[1]: Note that this setup does not results from the execution of the above commands. In particular ip link add type veth
would have resulted in the creation of a pair veth1@veth2
/ veth2@veth1
numbered this way because veth0
exists.