Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Network config: two networks cards, one subnet, one gateway.
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
Genootukas
n00b
n00b


Joined: 04 Dec 2019
Posts: 3

PostPosted: Wed Dec 04, 2019 8:26 am    Post subject: Network config: two networks cards, one subnet, one gateway. Reply with quote

Please help me. How to write correct network config when in virtual Gentoo box are two network cards (with IP failover, OVH dedicated server) and one subnet, one gateway in different subnet.
For example, must be:
ens18 card - IP - 12.34.567.135, gateway 123.456.784.254
ens19 card - IP - 12.34.567.131, gateway 123.456.784.254

Default configuration:

Code:
config_ens18="12.34.567.135 netmask 255.255.255.255 brd 12.34.567.135"
routes_ens18="123.456.784.254
default via 123.456.784.254"
dns_servers_ens18="213.186.33.99"

config_ens19="12.34.567.131 netmask 255.255.255.255 brd 12.34.567.131"
routes_ens19="123.456.784.254
default via 123.456.784.254"
dns_servers_ens19="8.8.8.8"


not working well. After restart all working, but after hour or two one of network card (ens18 or ens19) lost connection. Pls, help to write a good network config. Thanks a lot.
Back to top
View user's profile Send private message
lefsha
Veteran
Veteran


Joined: 30 Aug 2004
Posts: 1235
Location: Burgas, Bulgaria

PostPosted: Wed Dec 04, 2019 11:01 am    Post subject: Reply with quote

Power saving issue?
Could you disable it in kernel?

Do you have a bridge on top of these 2?
Otherwise only one card will be used and the other one will be suspended over time.

After reboot you may check which card is in use and then check if the other one
goes down over time.

P.S. You need pretty high load to make both cards busy. I do believe these are 1Gb cards.
_________________
Lefsha
Back to top
View user's profile Send private message
Genootukas
n00b
n00b


Joined: 04 Dec 2019
Posts: 3

PostPosted: Wed Dec 04, 2019 1:47 pm    Post subject: Reply with quote

Power saving completely disabled in kernel.
This is failover by OVH hosting company. IP asigned by mac address, no bridge in my side (bet I dont know anything about OVH side).
If I leave only one network card in system - everything works great. The problem is only when i try to configure both network cards.
For example, today everything worked great four hours. After that - ens19 card lost route. I wrote in terminal:
Code:
route add 123.456.784.254 ens19
route add default gw 123.456.784.254

and now both cards are working again.
Routing table in my system (IPs not real):
Code:
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         123.456.784.254 0.0.0.0         UG    0      0        0 ens19
default         123.456.784.254 0.0.0.0         UG    0      0        0 ens18
12.34.567.0     0.0.0.0         255.255.255.0   U     0      0        0 ens18
12.34.567.0     0.0.0.0         255.255.255.0   U     0      0        0 ens19
123.456.784.254 0.0.0.0         255.255.255.255 UH    0      0        0 ens19
123.456.784.254 0.0.0.0         255.255.255.255 UH    0      0        0 ens18
Back to top
View user's profile Send private message
lefsha
Veteran
Veteran


Joined: 30 Aug 2004
Posts: 1235
Location: Burgas, Bulgaria

PostPosted: Wed Dec 04, 2019 7:59 pm    Post subject: Reply with quote

Well, frankly I am not the best at solving network issues,
but I can't understand how the host goes outside if 2 ways are available.
According to your route table you are using only a single hardware adapter.
If a service or a program knows exactly that another adaptet or IP can be used
then it will be utilized. Otherwise it's down and your provider might bring it down.

I guess you need to read this: https://wiki.gentoo.org/wiki/Network_bridge
and set up your network accordingly.

If required there is nothing what prevents you to set multiple IP addresses to
a single here virtual interface.
_________________
Lefsha
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


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

PostPosted: Wed Dec 04, 2019 8:51 pm    Post subject: Reply with quote

Genootukas,

Code:
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         123.456.784.254 0.0.0.0         UG    0      0        0 ens19
default         123.456.784.254 0.0.0.0         UG    0      0        0 ens18
12.34.567.0     0.0.0.0         255.255.255.0   U     0      0        0 ens18
12.34.567.0     0.0.0.0         255.255.255.0   U     0      0        0 ens19
123.456.784.254 0.0.0.0         255.255.255.255 UH    0      0        0 ens19
123.456.784.254 0.0.0.0         255.255.255.255 UH    0      0        0 ens18

says you have two network cards doing the same thing.
Rules are tested from the bottom of the routing table working up
Packets are routed according to the first matching rule.

The default route matches all packets so your
Code:
default         123.456.784.254 0.0.0.0         UG    0      0        0 ens19
cn never be reached.
With all the useful information removed in your example, I can't give specific advice.
However, you need to give the kernel a reason to prefer one interface over the other.
That's usually done with the Metric value. Lower Metrics are preferred over higher Metrics.

I think you must use iproute2 to set the Metric.

I hope you have installed your own Gentoo. OVH-Gentoo was horribly out of date.
If you are using that we need to know.
_________________
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
Genootukas
n00b
n00b


Joined: 04 Dec 2019
Posts: 3

PostPosted: Thu Dec 05, 2019 7:18 am    Post subject: Reply with quote

Ghm... OK.. I will try to make one network interface with two IP addresses, but I dont know if it is possible to add second IP address in the same virtual mac in OVH failover.
For information only... This is virtual proxmox server with two virtual network interfaces (as Intel E1000) with different virtual MAC addresses.
Code:
ens18: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet xx.xx.xxx.135  netmask 255.255.255.0  broadcast xx.xx.xxx.135
        ether 02:00:00:a0:b2:f6  txqueuelen 1000  (Ethernet)
        RX packets 1720443  bytes 512919566 (489.1 MiB)
        RX errors 6085  dropped 0  overruns 0  frame 6085
        TX packets 1182064  bytes 1595380438 (1.4 GiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

ens19: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet xx.xx.xxx.131  netmask 255.255.255.0  broadcast xx.xx.xxx.131
        ether 02:00:00:99:e2:52  txqueuelen 1000  (Ethernet)
        RX packets 140756  bytes 20543648 (19.5 MiB)
        RX errors 6085  dropped 0  overruns 0  frame 6085
        TX packets 2561008  bytes 3293053735 (3.0 GiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 743102  bytes 1153870971 (1.0 GiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 743102  bytes 1153870971 (1.0 GiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

And.. of course this is own, fresh install.
Back to top
View user's profile Send private message
szatox
Advocate
Advocate


Joined: 27 Aug 2013
Posts: 3452

PostPosted: Fri Dec 06, 2019 10:09 am    Post subject: Reply with quote

Quote:
Ghm... OK.. I will try to make one network interface with two IP addresses, but I dont know if it is possible to add second IP address in the same virtual mac in OVH failover.
It is, as long as they are on the same physical machine, and it works pretty well for KVM.
You can't migrate them to another physical server without breaking the configuration though.
Not that migrating them live would work otherwise :lol: since the IP goes offline for a time period depending on your luck (and in case of some particular racks, takes the whole machine offline until that transfer completes).
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