Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Here the name is eth0. I think :0 is not really needed - it's the same as no suffix. You need to add :1 for the second one, :2 for the third and so on.
Add gateway to the first one - outgoing traffic will come from this one.
Here the name is eth0. I think :0 is not really needed - it's the same as no suffix. You need to add :1 for the second one, :2 for the third and so on.
Add gateway to the first one - outgoing traffic will come from this one.
Hello,
Thank you so much for your reply.
What I have done is wrong?
It looks like you set it up in a different file. I usually just edit the file and append. In your case, it's /etc/network/interfaces.d/enp0s3
Try to add this:
Code:
auto enp0s3:1
iface enp0s3:1 inet static
address 10.0.5.20
netmask 255.255.255.0
I think using :0 will just overwrite the other one.
Hello,
Thank you so much for your reply.
If the NIC receives the IP from the DHCP service, then there is no file under the /etc/network/interfaces.d/ directory and just a /etc/network/interfaces file.
I have two questions:
1- Are you sure enp0s3:0 is wrong?
2- Is it possible for enp0s3 to get the address from DHCP but enp0s3:1 manually?
Those changes have to be followed by stopping networking and downing and up.
Hello,
Thanks.
I restarted the networking service.
So, the enp0s3:0 is correct. Am I right?
Is it possible for enp0s3 to get the address from DHCP but enp0s3:0 manually?
Is it difficult to set multiple IP addresses on a NIC in Linux?
No, it's dead easy:
Code:
ip addr add <address>/<CIDR> dev <interface>
The problems you're having are related to your distribution, not the Linux kernel. It seems your network scripts require that you use aliases, an old and deprecated mechanism where you would assign additional addresses to an interface alias called <interface>:<alias>.
This is rather confusing, as it looks like you're creating something akin to a virtual interface (like you stated in your other thread), but that's not at all the case.
You should check the documentation for your distribution to see if the scripts support adding multiple addresses to the same interface using a more recent (non-deprecated) mechanism.
The problems you're having are related to your distribution, not the Linux kernel. It seems your network scripts require that you use aliases, an old and deprecated mechanism where you would assign additional addresses to an interface alias called <interface>:<alias>.
This is rather confusing, as it looks like you're creating something akin to a virtual interface (like you stated in your other thread), but that's not at all the case.
You should check the documentation for your distribution to see if the scripts support adding multiple addresses to the same interface using a more recent (non-deprecated) mechanism.
Create subinterface on Ubuntu – Debian permanently. Add eth0:0 interface to /etc/network/interfaces
root@ubuntu:~# vi /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.0.106
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1
auto eth0:0
iface eth0:0 inet static
address 192.168.0.107
netmask 255.255.255.0
root@ubuntu:~#
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.