Teach you how to use RedHat as an agent

Source: Internet
Author: User
Teach you how to use RedHat as a proxy-Linux Enterprise Application-Linux server application information. The following is a detailed description. The proxy made with the RedHat series is currently the best product in the same industry, and its security is better than Smoothwall's functions and stability than ROS. Maybe you will ask why there are not many ROS users since it is so good, because the RedHat series are mostly local, and the domestic network administrators are not comfortable with the text format because they are used to the graphic interface, and they still need strong English as the backing to learn it well, A wealth of network knowledge is used as the basis, and this information is poor on the Internet.

First, install Linux and prepare a server with two NICs. One Network Card is connected to the Intranet and the other is connected to the Internet. For example, the Internet IP address of the Internet cafe is 61.178.89.234 and the Intranet IP address segment is 192.168.1.1-192.168.1.255.

After the server starts up, first configure eth0 (the network card of the Internet, note: eth0 is an Internet network card, eth1 is an Intranet network card), assign the address 61.178.89.234 to the network card, and run the following command:

# Ifconfig eth0 61.178.89.234 netmask 255.255.255.0

Edit the/etc/sysconfig/network-scripts/ifcfg-eth0 file in the following format, after modification, Press Esc and enter again: wq press enter to save and Exit)

DEVICE = eth0 note: this is the DEVICE name
ONBOOT = yes Note: Indicates Automatic startup at system startup
BROADCAST = 61.178.89.255 note: this is the BROADCAST address.
NETWORK = 61.178.89.0 Note: NETWORK Address
NETMASK = 255.255.0.0 Note: Subnet Mask
IPADDR = 61.178.89.234 Note: IP Address

Add a static route:

# Route add-net 61.178.89.0 netmask 255.255.255.0

In this way, a static route is added to the system: You can enter the route command to view

61.178.89.0*255.255.255.0 U 0 0 0 eth0

Then, configure eth1, connect eth1 to the Intranet segment, assign it IP 192.168.1.1, and use the ifconfig command to configure parameters for it:

# Ifconfig eth1 192.168.1.1 netmask 255.255.255.0

Also, edit the ifcfg-eth1 file under the/etc/sysconfig/network-scripts directory as follows:

DEVICE = eth1
ONBOOT = yes
BROADCAST = 192.168.1.255
NETWORK = 192.168.1.0
NETMASK = 255.255.255.0
IPADDR = 192.168.1.1

Add another static route:

# Route add-net 192.168.1.0 netmask 255.255.255.0

The current route table in the network is: you can enter the route command to view

61.178.89.0*255.255.255.0 U 0 0 0 eth0
192.168.1.0*255.255.255.0 U 0 0 0 eth1

Then add a default route because the default route sends all data packets to the gateway at the upper level. Run the following command:

# Route add default gw 61.178.89.1

Now the route table has been created. Let's enter the command route.

# Route

If everything goes well, it should be shown as follows:

61.178.89.0*255.255.255.0 U 0 0 0 eth0
192.168.1.0*255.255.255.0 U 0 0 0 eth1
Default 61.178.89.1 0.0.0.0 UG 0 0 0 eth0

Well, now it's almost finished. Continue and you'll be successful soon :)
The last step is to add the IP forwarding function of the system to rc. local.

Edit/etc/rc. local
# Vi/etc/rc. local

Press the Insert key on the keyboard to convert to the Insert mode, and then add

Echo 1>/proc/sys/net/ipv4/ip_forward

Press Esc and enter wq and press enter to save and exit.
Enter the command

# Iptables-t nat-a postrouting-s 192.168.1.0/24-j MASQUERADE

Now, set the gateway of the Intranet machine to 192.168.1.1 and check whether the Intranet machine can access the Internet. If you want the server to automatically proxy the Internet when it starts, add

/Sbin/iptables-t nat-a postrouting-s 192.168.1.0/24-j MASQUERADE

That's it, huh, right? In fact, it is not difficult for any good system to learn it as long as it is learned :)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.