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 configure dual Network Card and dual Gateway routing Table in Linux

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

Share

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

This article is about how to configure the dual-card and dual-gateway routing table in Linux. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Server operating system RedHat linux 9, set up two routing tables

1. Vi / etc/iproute2/rt_tables, add Netcom and Telecom routing tables

251tel Telecom routing Table

252 cnc Netcom routing table

two。 Bind two addresses to the network card for telecom and Netcom lines

Ip addr add 192.168.0.2/24 dev eth0

Ip addr add 10.0.0.2/24 dev eth2

3. Set up the routing tables of Telecom and Netcom respectively

Telecom routing table:

# make sure the local subnet is found

Ip route add 192.168.0..0/24 via 192.168.0.2 dev eth0 table tel

# Internal loopback network

Ip route add 127.0.0.0/8 dev lo table tel

# 192.168.0.1 is the default gateway address of telecom network

Ip route add default via 192.168.0.1 dev eth0 table tel

Netcom line routing table:

# make sure the local subnet is found

Ip route add 10.0.0.0/24 via 10.0.0.2 dev eth2 table cnc

# Internal loopback network

Ip route add 127.0.0.0/8 dev lo table cnc

# 10.0.0.1 is the default gateway of Netcom

Ip route add default via 10.0.0.1 dev eth2 table cnc

4. Telecom and Netcom each have their own routing tables and formulate strategies to route the response packets of 192.168.0.2 and 10.0.0.2 to Netcom's routing table.

Ip rule add from 192.168.0.1 table tel

Ip rule add from 10.0.0.1 table cnc

Thank you for reading! This is the end of the article on "how to configure dual-card and dual-gateway routing tables in Linux". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

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