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 Telecom Netcom dual IP on the server of Linux system

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article introduces the relevant knowledge of "how to configure telecom Netcom dual IP on Linux system server". In the operation process of actual cases, many people will encounter such difficulties. Next, let Xiaobian lead you to learn how to deal with these situations! I hope you can read carefully and learn something!

For a two-wire, dual-IP server, there are two problems to solve:

What IP does your website user use to access your server?

Second, your website content exactly go that IP back to the user

For the first problem, you can use intelligent DNS resolution to solve, that is, DNS server determines the IP address of the user, if the user is a telecommunications access, the server's telecommunications IP resolution to him; if the user is a Netcom access, the server's Netcom IP resolution to him.

Intelligent DNS can be customized based on open source DNS software, but there is a good free intelligent DNS server provider in China: DNSPod, which is recommended to use DNSPod services. He can implement the above intelligent DNS resolution.

BIND software package can also be implemented, specific configuration see this link Baidu library: wenku.baidu.com/view/81b383eb998fcc22bcd10d97.html

For the second problem, you need to configure routing rules on the server to determine how to handle the return path of the data.

1. Fill in the static routing table

Because the server has two IPs, respectively in different network segments, you use the gateway of telecom IP to do routing, then Netcom IP address users simply can not access, and vice versa. At present, the popular solution is to use telecom gateway to do default routing, and then manually fill in all Netcom IP address segment routing rules. This method can be Google search to a lot, do not expand.

The disadvantage of this method is that it is too much trouble to add rules, and it is inevitable that if you miss some segments, then users of these segments will not be able to access your website. Moreover, the distribution of network segment addresses is always changing, and you must update the routing table regularly.

2. Set dynamic routing according to the incoming path of user access

That is to say, if the user is accessed through the telecom IP address, then the telecom gateway is used for routing, and the returned content goes through the telecom gateway; if the user is accessed through the Netcom IP address, then the Netcom gateway is used for routing, and the returned content goes through the Netcom gateway, so that it is not necessary to maintain the routing table so troublesome. Take JavaEye website server as an example, the specific configuration method is as follows:

Server Telecom IP: 114.80.66.199, Telecom Gateway: 114.80.66.1

Server Netcom IP: 60.29.231.190, Netcom Gateway: 60.29.231.1

1)Default gateway uses telecom gateway as route

Configure the default gateway on Linux. If it is RedHat, you should add a line in the/etc/sysconfig/network file: GATEWAY= 114.80.66.1. If it is SuSE, you should add a line in/etc/sysconfig/network/routes: default 114.80.66.1 - -or you can directly use YaST2 to configure it.

2) Add routing table

Modify/etc/iroute 2/rt_tables to add:

252 tel telecom routing table

251 cnc netcom routing table

Then manually add routing rules and execute the following command in Console:

The code is as follows:

#Add backtracking routes

ip route flush table tel

ip rule add from 114.80.66.199 table tel

ip route add default via 114.80.66.1 dev eth0 src 114.80.66.199 table tel

ip route flush table cnc

ip rule add from 60.29.231.190 table cnc

ip route add default via 60.29.231.1 dev eth2 src 60.29.231.190 table cnc

That is to say, the request from telecom IP is returned according to telecom route, and the request from Netcom IP is returned from Netcom route. That's it, isn't it?

3) Write routing rules into startup script

If the server restarts or the network service restarts, the above routing rules will be invalid, so you need to write the above command into the system startup script and network startup script.

If Red Hat, the system startup script is/etc/rc.d/rc.local

If it is SuSE, you can write a startup script yourself and link it to S99, such as/etc/init.d/rc.local

For Red Hat, the network startup script is/etc/rc.d/init.d/network

If SuSE, the network startup script is/etc/init.d/network

Configuration check:

The code is as follows:

ip route list table 251

ip rule list

ip route show

"Linux system server how to configure telecommunications Netcom dual IP" content is introduced here, thank you for reading. If you want to know more about industry-related knowledge, you can pay attention to the website. Xiaobian will output more high-quality practical articles for everyone!

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