On Thursday, January 17, 2019 10:37:32 PM CET Alarig Le Lay wrote:
> Hi,
> 
> I would like to set the alias of my interfaces at boot (if possible with
> netifrc).
> 
> Here are the relevant parts of my configuration:
> config_enp3s0f0="null"
> vlans_enp3s0f0="20 21 22 50"
> config_enp3s0f0_22="185.1.89.13/24 2001:7f8:b1::d/64"
> 
> My interface is well created, but if I want an alias, I have to do it by
> hand:
> asbr02 ~ # ip addr show enp3s0f0.22
> 11: enp3s0f0.22@enp3s0f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc
> noqueue state UP group default qlen 1000 link/ether 00:1b:21:48:68:98 brd
> ff:ff:ff:ff:ff:ff
>     inet 185.1.89.13/24 brd 185.1.89.255 scope global enp3s0f0.22
>        valid_lft forever preferred_lft forever
>     inet6 2001:7f8:b1::d/64 scope global
>        valid_lft forever preferred_lft forever
>     inet6 fe80::21b:21ff:fe48:6898/64 scope link
>        valid_lft forever preferred_lft forever
> asbr02 ~ # ip link set enp3s0f0.22 alias "Peering: BreizhIX"
> asbr02 ~ # ip link show enp3s0f0.22
> 11: enp3s0f0.22@enp3s0f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc
> noqueue state UP mode DEFAULT group default qlen 1000 link/ether
> 00:1b:21:48:68:98 brd ff:ff:ff:ff:ff:ff
>     alias Peering: BreizhIX
> 
> On FreeBSD, I did that with an /etc/start_if script:
> ifconfig igb0.22 create
> ifconfig igb0.22 description "Peering: BreizhIX"
> ifconfig igb0.22 vlan 22 vlandev igb0
> ifconfig igb0.22 inet 185.1.89.13/24
> ifconfig igb0.22 inet6 2001:7f8:b1::d/64
> 
> 
> I didn’t find any mention of this in
> /usr/share/doc/netifrc-0.5.1/net.example.bz2
> 
> Am I missing something?

Not sure if you can use spaces in the name, but I have the following:

$ cat /etc/conf.d/net
#config_eno1="dhcp"

config_eno1="null"
vlans_eno1="10 15"
vlan10_name="adm"
vlan15_name="str"
rc_net_adm_need="net.eno1"
rc_net_str_need="net.eno1"
config_adm="10.55.16.44 netmask 255.255.255.0 broadcast 10.55.16.255"
routes_adm="default gw 10.55.16.68"
config_str="10.30.15.44 netmask 255.255.255.0 broadcast 10.30.15.255"

For this to work, configured the init-scripts as:

$ ls -l /etc/init.d/net.*
lrwxrwxrwx 1 root root     6 Jun 16  2016 /etc/init.d/net.adm -> net.lo
lrwxrwxrwx 1 root root     6 Jun 15  2016 /etc/init.d/net.eno1 -> net.lo
-rwxr-xr-x 1 root root 18514 Mar  2  2018 /etc/init.d/net.lo
lrwxrwxrwx 1 root root     6 Jun 16  2016 /etc/init.d/net.str -> net.lo

And only have to add "net.adm" and "net.str" to the runlevel.

--
Joost Roeleveld




Reply via email to