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/04/2016 04:40 PM, Walter H. wrote:
On 04.09.2016 15:18, Ulf Volmer wrote:
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?
no other values needed. i assume that the second ip is in the same subnet as the first one.
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?
I'm not sure at this point. If you have to add a second ip in another different network maybe you need a virtual device.
best regards Ulf
On 09/04/2016 05:00 PM, Ulf Volmer wrote:
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?
I'm not sure at this point. If you have to add a second ip in another different network maybe you need a virtual device.
OK, some testing has been done. you have to specify
IPADDR=192.168.0.10 NETMASK=255.255.255.0 NETWORK=192.168.0.0 GATEWAY=192.168.0.1 IPADDR2=192.168.2.10 NETMASK2=255.255.255.0 NETWORK2=192.168.2.0
please note, that you have to specify only one GATEWAY, there can be only one default gateway active.
best regards Ulf
On 04.09.2016 17:33, Ulf Volmer wrote:
OK, some testing has been done. you have to specify
IPADDR=192.168.0.10 NETMASK=255.255.255.0 NETWORK=192.168.0.0 GATEWAY=192.168.0.1 IPADDR2=192.168.2.10 NETMASK2=255.255.255.0 NETWORK2=192.168.2.0
I tried this way; but 'ifconfig' doesn't show these additional addresses ...
please note, that you have to specify only one GATEWAY, there can be only one default gateway active.
sure? thought that IPADDR, GATEWAY, NETMASK and NETWORK must go with, the same with IPADDR2, GATEWAY2, NETMASK2 and NETWORK2 ...
Walter
Hi,
It works, but, it didn't create "virtual address" aka "eth0:0", try using "ip" command: "ip addr show dev eth0"
Att.,
Antonio.
2016-09-04 14:27 GMT-03:00 Walter H. Walter.H@mathemainzel.info:
On 04.09.2016 17:33, Ulf Volmer wrote:
OK, some testing has been done. you have to specify
IPADDR=192.168.0.10 NETMASK=255.255.255.0 NETWORK=192.168.0.0 GATEWAY=192.168.0.1 IPADDR2=192.168.2.10 NETMASK2=255.255.255.0 NETWORK2=192.168.2.0
I tried this way; but 'ifconfig' doesn't show these additional addresses ...
please note, that you have to specify only one GATEWAY, there can be
only one default gateway active.
sure? thought that IPADDR, GATEWAY, NETMASK and NETWORK must go with, the same with IPADDR2, GATEWAY2, NETMASK2 and NETWORK2 ...
Walter
CentOS mailing list CentOS@centos.org https://lists.centos.org/mailman/listinfo/centos
On 09/04/2016 07:27 PM, Walter H. wrote:
On 04.09.2016 17:33, Ulf Volmer wrote:
please note, that you have to specify only one GATEWAY, there can be only one default gateway active.
sure? thought that IPADDR, GATEWAY, NETMASK and NETWORK must go with, the same with IPADDR2, GATEWAY2, NETMASK2 and NETWORK2 ...
There can be only one default gateway defined on you system. Yes, sure.
best regards Ulf
On Sep 4, 2016, at 1:27 PM, Walter H. walter.h@mathemainzel.info wrote:
'ifconfig' doesn't show these additional addresses ...
This is one of the many reasons why people don’t use ‘ifconfig’ anymore.
-- Jonathan Billings billings@negate.org
--On Monday, September 05, 2016 9:27 AM -0400 Jonathan Billings billings@negate.org wrote:
This is one of the many reasons why people don't use 'ifconfig' anymore.
Is there a preferred tool? Perhaps a script that will dump out the full network configuration for easy checking?
On Mon, 5 Sep 2016 15:05, Kenneth Porter wrote:
On Monday, September 05, 2016 9:27 AM -0400 Jonathan Billings wrote:
This is one of the many reasons why people don't use 'ifconfig' anymore.
Is there a preferred tool? Perhaps a script that will dump out the full network configuration for easy checking?
How about using the "ip" tool?
"ip addr show" and "ip route show"
should give the needed info, at least with Centos 7.x
- Yamaban.
--On Monday, September 05, 2016 4:15 PM +0200 Yamaban foerster@lisas.de wrote:
How about using the "ip" tool?
Thanks. I looked at the man page and it looks like it's the Swiss army knife of Linux networking. Lots of subcommands. I'll dig through that.
Am 05.09.2016 um 15:29 schrieb Kenneth Porter:
--On Monday, September 05, 2016 4:15 PM +0200 Yamaban foerster@lisas.de wrote:
How about using the "ip" tool?
Thanks. I looked at the man page and it looks like it's the Swiss army knife of Linux networking. Lots of subcommands. I'll dig through that.
Probably a useful summary of ip (from iproute2) usecases:
https://dougvitale.wordpress.com/2011/12/21/deprecated-linux-networking-comm...
While at it, forget about netstat and route as well ;)
Alexander
On 09/05/16 08:56, Alexander Dalloz wrote:
Am 05.09.2016 um 15:29 schrieb Kenneth Porter:
--On Monday, September 05, 2016 4:15 PM +0200 Yamaban foerster@lisas.de wrote:
How about using the "ip" tool?
Thanks. I looked at the man page and it looks like it's the Swiss army knife of Linux networking. Lots of subcommands. I'll dig through that.
Probably a useful summary of ip (from iproute2) usecases:
https://dougvitale.wordpress.com/2011/12/21/deprecated-linux-networking-comm...
While at it, forget about netstat and route as well ;)
Alexander
CentOS mailing list CentOS@centos.org https://lists.centos.org/mailman/listinfo/centos
As a matter of curiosity, why didn't someone setup ifconfig/netstat/route commands that just referenced & passed args to ip, kinda like grep/egrep/fgrep & possibly others ? Would have made the transition a bit gentler .... $0.02, no more, no less ....
On Tue, 6 Sep 2016 02:14, Always Learning wrote:
On Mon, 2016-09-05 at 15:15 +0200, Yamaban wrote:
"ip addr show" and "ip route show"
should give the needed info, at least with Centos 7.x
Works on C5 and C6 too.
Good to know, b/c as my contact with C5 is minimal and no-existant with C6 , I could not check myself. C7 otoh, I use regulary.
- Yamaban.
Am 05.09.2016 um 14:27 schrieb Jonathan Billings:
On Sep 4, 2016, at 1:27 PM, Walter H. walter.h@mathemainzel.info wrote:
'ifconfig' doesn't show these additional addresses ...
This is one of the many reasons why people don’t use ‘ifconfig’ anymore.
As additional information: ifconfig as part of net-tools is deprecated since 2009. See for a longer discussion
https://serverfault.com/questions/633087/where-is-the-statement-of-deprecati...
net-tools isn't any longer installed by default on CentOS 7. It is time to let it go because of its shortcomings.
Jonathan Billings billings@negate.org
Regards
Alexander
On 05.09.2016 15:28, Alexander Dalloz wrote:
Am 05.09.2016 um 14:27 schrieb Jonathan Billings:
On Sep 4, 2016, at 1:27 PM, Walter H. walter.h@mathemainzel.info wrote:
'ifconfig' doesn't show these additional addresses ...
This is one of the many reasons why people don’t use ‘ifconfig’ anymore.
As additional information: ifconfig as part of net-tools is deprecated since 2009.
of course one can run ip .... commands having the same result as the ifconfig thing, but how would this go, when e.g. eth0 shall be up at OS startup?
e.g. /etc/sysconfig/network-scripts/route6-sit1 with this content ::/0 dev sit1 does the job automatically using ip .... (ip route add ::/0 dev sit1)
you will find e.g. where one runs iptables -A .... ip6tables -A ... or other firewall solutions; but all this doesn't make any sense as long it is done automatically after OS startup;
https://serverfault.com/questions/633087/where-is-the-statement-of-deprecati...
net-tools isn't any longer installed by default on CentOS 7.
no ip ... command?
On Sun, September 4, 2016 9:40 am, Walter H. wrote:
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 <--
Interesting... With these settings, namely GATEWAY2=..., how the arbitration is done (in networks stack) which of gateways is used for packets to be sent outside of networks the machine is on?
As far as I know FreeBSD, there can be only one gateway (BTW, synonym: default gateway). Theoretically, the machine can have more than one gateway, but for that you need to have specially configured firewall/nat. Is this somehow different in Linux, and Linux does that auto-magically?
Valeri
in case they don't match the first IP address?
Thanks, Walter
CentOS mailing list CentOS@centos.org https://lists.centos.org/mailman/listinfo/centos
++++++++++++++++++++++++++++++++++++++++ Valeri Galtsev Sr System Administrator Department of Astronomy and Astrophysics Kavli Institute for Cosmological Physics University of Chicago Phone: 773-702-4247 ++++++++++++++++++++++++++++++++++++++++
Valeri,
not on list as it does not pertain to Linux.
On Sun, Sep 04, 2016 at 10:25:23AM -0500, Valeri Galtsev wrote:
...
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 <--
Interesting... With these settings, namely GATEWAY2=..., how the arbitration is done (in networks stack) which of gateways is used for packets to be sent outside of networks the machine is on?
As far as I know FreeBSD, there can be only one gateway (BTW, synonym: default gateway). Theoretically, the machine can have more than one gateway, but for that you need to have specially configured firewall/nat. Is this somehow different in Linux, and Linux does that auto-magically?
Decades ago, I was running Solaris x86 at home. My internet connection was a 24/7 14.4KBaud phone connection to my ISP. I then added my first broadband cable connection. During the transition I investigated dual gateways. At that time, Solaris just alternated between the two. It wasn't load balancing, and once a connection was made it stayed with that interface if it was up. Just new connections alternately were sent via one or the other gateway interfaces.
Jon
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.100
In 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:1
Mostly because device aliases are obsolete: https://www.kernel.org/doc/Documentation/networking/alias.txt