Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
How to permanently add IP adresses to my dev eth0 ?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
yarek
n00b
n00b


Joined: 16 Nov 2017
Posts: 3

PostPosted: Thu Nov 16, 2017 9:45 am    Post subject: How to permanently add IP adresses to my dev eth0 ? Reply with quote

Hello:
I have a dedicated server on OVH hosting with 8 Ip fails overs IPs.

I use to add these IPs with that command

ip addr add 137.74.80.16/32 dev eth0;
ip addr add 137.74.80.17/32 dev eth0;
(...)

These are not permanent and once server rebooted, it lost all configurations.

How to permanently add IP adresses to my dev eth0 ?

(I read that: https://wiki.gentoo.org/wiki/Handbook:X86/Full/Networking but I was unable to complete the task)

regards
Back to top
View user's profile Send private message
joanandk
Apprentice
Apprentice


Joined: 12 Feb 2017
Posts: 169

PostPosted: Thu Nov 16, 2017 10:15 am    Post subject: Re: How to permanently add IP adresses to my dev eth0 ? Reply with quote

yarek wrote:
(I read that: https://wiki.gentoo.org/wiki/Handbook:X86/Full/Networking but I was unable to complete the task)


I doubt that. Did you read the "Advanced configuration" and seen the "/etc/conf.d/net" ??
Back to top
View user's profile Send private message
yarek
n00b
n00b


Joined: 16 Nov 2017
Posts: 3

PostPosted: Thu Nov 16, 2017 10:20 am    Post subject: Reply with quote

I did read it.
But I am not a linux guru and was unable to add an IP
regards
Back to top
View user's profile Send private message
chiefbag
Guru
Guru


Joined: 01 Oct 2010
Posts: 542
Location: The Kingdom

PostPosted: Thu Nov 16, 2017 10:34 am    Post subject: Reply with quote

You would use the following and note the "/24" instead of "/32" if you want netmask 255.255.255.0

In "/etc/conf.d/net"

Code:

config_eth0="137.74.80.16/24
137.74.80.17/24"
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54216
Location: 56N 3W

PostPosted: Thu Nov 16, 2017 10:37 am    Post subject: Reply with quote

yarek,

OVH Gentoo Release 2 ... yuck!

You may have a file /etc/conf.d/net but Gentoo will work without it. You will get a single dynamically assigned IP address if this file is missing.

You must create this file. If you mess up, you will need to use the rescue system to fix it because you may end up with no network connectivity.

The file needs to contain.

Code:
config_eth0="192.168.100.20/24 brd 192.168.100.255"
routes_eth0="default via 192.168.100.253"
Those are my addresses. You need to change them for your IP address and default route that OVH gave you.

So far this is just the default setup - no extra IPs.
Test it - be prepared to use the rescue console to rename /etc/conf.d/net if you can no longer connect once eth0 is restarted.

Once it works, you can add more addresses to the config_eth0= statement. See /usr/share/doc/netifrc-0.5.1/net.example.bz2 for worked examples.
Note that netifrc-0.5.1 is the version I have. Yours may be older.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
yarek
n00b
n00b


Joined: 16 Nov 2017
Posts: 3

PostPosted: Thu Nov 16, 2017 10:39 am    Post subject: Reply with quote

so I should add :

Code:
config_eth0="137.74.80.16/24
137.74.80.17/24"

config_eth0="137.74.80.17/24
137.74.80.17/24"


...

Regards
Back to top
View user's profile Send private message
joanandk
Apprentice
Apprentice


Joined: 12 Feb 2017
Posts: 169

PostPosted: Thu Nov 16, 2017 10:43 am    Post subject: Reply with quote

yarek wrote:
I did read it.
But I am not a linux guru and was unable to add an IP
regards


Then, could you tell us where you have failed?
a) Did you edit the /etc/conf.d/net
b) Can you execute (after editing /etc/conf.d/net)
Code:
/etc/init.d/net.eth0 restart
and send us the output
c) What is the output of
Code:
ifconfig eth0


BR
Back to top
View user's profile Send private message
joanandk
Apprentice
Apprentice


Joined: 12 Feb 2017
Posts: 169

PostPosted: Thu Nov 16, 2017 10:46 am    Post subject: Reply with quote

yarek wrote:
so I should add :

Code:
config_eth0="137.74.80.16/24
137.74.80.17/24"

config_eth0="137.74.80.17/24
137.74.80.17/24"


...

Regards


It depends! What is the IP given from your provider? Where is the default gateway for that Subnet and where is the broadcast address?

BR
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54216
Location: 56N 3W

PostPosted: Thu Nov 16, 2017 11:00 am    Post subject: Reply with quote

yarek,

Close but not correct.

You should have only a single config_eth0= statement listing all the IPs.
With multiple config_eth0= statements, only the last one will have any effect.

You must have a routes_eth0= statement to set your default route.
Without that, you don't have any network other than the local subnet - no internet!

Is the /24 correct? What did OVH tell you?
Its a long time since I had an OVH server.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum