Hello /etc/sysconfig/network-scripts/ifcfg-eth0 looks like this: # Intel Corporation 82545EM Gigabit Ethernet Controller (Copper) TYPE=Ethernet NAME=eth0 NM_CONTROLLED=no IPV4_FAILURE_FATAL=yes UUID=cc2635ff-3c14-48ba-b19a-84c5b9d36a9d ONBOOT=yes DEVICE=eth0 BOOTPROTO=none HWADDR=00:50:56:01:00:01 BROADCAST=192.168.0.255 IPADDR=192.168.0.10 NETMASK=255.255.255.0 NETWORK=192.168.0.0 GATEWAY=192.168.0.1 DNS1=192.168.0.1 DNS2=192.168.0.100 DOMAIN='domain.tld' USERCTL=no IPV6INIT=yes IPV6ADDR=ipv6addr IPV6_AUTOCONF=no IPV6_DEFAULTGW=ipv6addr-gateway IPV6_DEFAULTDEV=eth0 if I would need an additional IPv6 address I'd just add IPV6ADDR_SECONDARIES="ipv6addr" to this file; if I would need an additional IPv4 address this works only by a virtual device e.g. eth0:1 like this: /etc/sysconfig/network-scripts/ifcfg-eth0:1 # Intel Corporation 82545EM Gigabit Ethernet Controller (Copper), Alias 1 TYPE=Ethernet DEVICE=eth0:1 ONPARENT=yes BOOTPROTO=none BROADCAST=192.168.0.255 IPADDR=192.168.0.17 NETMASK=255.255.255.0 NETWORK=192.168.0.0 GATEWAY=192.168.0.1 DNS1=192.168.0.1 DNS2=192.168.0.100 why can't I add this to the virtual device eth0:1, if I needed both an additional IPv4 and an additional IPv6 address? IPV6INIT=yes IPV6ADDR=ipv6addr IPV6_AUTOCONF=no IPV6_DEFAULTGW=ipv6addr-gateway IPV6_DEFAULTDEV=eth0:1 Thanks, Walter
On 09/03/2016 07:34 PM, Walter H. wrote:> if I would need an additional IPv6 address I'd just add > IPV6ADDR_SECONDARIES="ipv6addr" > to this file; if I would need an additional IPv4 address this works only > by a virtual device > e.g. eth0:1 like this:That's not true, you can add ipv4 address to the interface in the same way: | IPADDR2=172.17.170.101 | NETMASK2=255.255.255.0 There is no need to create a virtual network device. best regards Ulf
On 04.09.2016 15:18, Ulf Volmer wrote:> On 09/03/2016 07:34 PM, Walter H. wrote: > >> if I would need an additional IPv6 address I'd just add >> IPV6ADDR_SECONDARIES="ipv6addr" >> to this file; if I would need an additional IPv4 address this works only >> by a virtual device >> e.g. eth0:1 like this: > That's not true, you can add ipv4 address to the interface in the same way: > > | IPADDR2=172.17.170.101 > | NETMASK2=255.255.255.0 > > There is no need to create a virtual network device.ah ok, and the other values? IPADDR2=192.168.1.10 BROADCAST2=192.168.1.255 <-- NETMASK2=255.255.255.0 NETWORK2=192.168.1.0 <-- GATEWAY2=192.168.1.1 <-- in case they don't match the first IP address? Thanks, Walter
On 09/03/2016 10:34 AM, Walter H. wrote:> /etc/sysconfig/network-scripts/ifcfg-eth0:1 > # Intel Corporation 82545EM Gigabit Ethernet Controller (Copper), Alias 1 > TYPE=Ethernet > DEVICE=eth0:1 > ONPARENT=yes > BOOTPROTO=none > BROADCAST=192.168.0.255 > IPADDR=192.168.0.17 > NETMASK=255.255.255.0 > NETWORK=192.168.0.0 > GATEWAY=192.168.0.1 > DNS1=192.168.0.1 > DNS2=192.168.0.100In alias files: * BOOTPROTO isn't used, since you can't run dhclient on an alias interface * GATEWAY is disregarded if it is already set * DNS* aren't used at all ...and in no case do you really need to specify all of BROADCAST, NETWORK, and NETMASK. The latter, alone, is sufficient. See /usr/share/doc/initscripts*/sysconfig.txt and /etc/sysconfig/network-scripts/ifup-aliases for more information. Since not all of them were mentioned in this thread, there are at least three ways to specify additional IPv4 addresses. First, use IPADDRn and either PREFIXn or NETMASKn in ifcfg-dev (documented in sysconfig.txt). Second, use alias files such as ifcfg-dev:alias (documented in sysconfig.txt). Third, use range files such as ifcfg-dev-range0 to specify all of the addresses from a START to an END address (documented in ifup-aliases).> why can't I add this to the virtual device eth0:1, > if I needed both an additional IPv4 and an additional IPv6 address? > IPV6INIT=yes > IPV6ADDR=ipv6addr > IPV6_AUTOCONF=no > IPV6_DEFAULTGW=ipv6addr-gateway > IPV6_DEFAULTDEV=eth0:1Mostly because device aliases are obsolete: https://www.kernel.org/doc/Documentation/networking/alias.txt