Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to set up double Network Card and single Gateway on Linux

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces how to set up a double network card single gateway on Linux, which has a certain reference value. Interested friends can refer to it. I hope you will gain a lot after reading this article.

Want to test Cache's server to run 2G traffic. Try to add 20% weight to that server on your IP scheduler, so that the request will add 20% more to the original basis. It turns out that the whole machine basically floats in 800M-900M. So you have to use another network card to run, do not want to bind. This time its performance has been monitored because of the new adjustment.

It is obvious that the value behind is getting larger and larger, which is higher than the average of the previous 17%. It is found that there is a significant performance degradation.

My original server environment:

Network card 1 (eth0) IP:112.253.xx.45 gateway address: 112.253.xx.5 network card II (eth2) IP:112.253.xx.160 gateway address: 112.253.xx.5

Then go up and use iftop to see that all the traffic is running the default network card. So the flow exit is still unchanged, so much at most. You can only call the technology of two-line routing, the traffic coming in from that port. Return from the entry port, which is the so-called original return routing function. First, add two routing table information: net_eth0 and net_eth2.

$vim / etc/iproute2/rt_tables 252 net_eth0 251 net_eth2

Then use the following command. To configure these two routing table information and write them to rc.local

Ip route flush table net_eth0 ip route add default via 112.253.xx.5 dev eth0 src 112.253.xx.45 table net_eth0 ip rule add from 112.253.xx.45 table net_eth0 ip route flush table net_eth2 ip route add default via 112.253.xx.5 dev eth2 src 112.253.xx.160 table net_eth2 ip rule add from 112.253.xx.5 table net_eth2

The above means to set the default routing gateway and IP on the interfaces of the two network cards. The gateway is the same because I am in the same segment. If you want to do the second line of Telecom Netcom to distinguish user requests, you need to set them into two gateways for Telecom Netcom. Then set what source through the two routing tables.

Thank you for reading this article carefully. I hope the article "how to set up a double Network Card single Gateway on Linux" shared by the editor will be helpful to you. At the same time, I also hope that you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report