Battle RedHat9 Configuring ADSL Sharing Internet Server

zhaozj2021-02-16  89

Many of the articles on the Internet are not full, but in most of their way, consolidate their methods, finally succeeded! Written it and hope to help everyone, please contact Petehero@126.com discussion.

Redhat server: NIC Eth0: 192.168.0.1/255.255.255.0 Other gateways, DNS, etc. Do not configure the client: IP address is set to 192.168.0.2-192.168.0.0.0.254 IP address, the subnet mask is 255.255.255.0 The gateway points to 192.168.0.1, DNS points to the ISP DNS address, such as 202.106.0.20, etc.

RedHat9 has installed the ADSL dial program by default. Can be configured directly.

Command line input: ADSL-SETUP enters the configuration dialog (if the path is not found, enter / sbin / adsl-setup)

Welcome to the ADSL Client Setup. First, I Will Run Some Checks OnYour System To Make Sure The PPPoE Client Is Installed Properly ...

The Following DSL Config Was Found On Your System:

Device: Name: PPP0 DSLPPP0

Please enter the device if you want to configure the device dsl config (default ppp0) or enter n if you want to create a new one: The established dial-up connection name, direct carriage return by default

Login Name

Enter Your Login Name (Default): Enter the login user name for the ADSL account

Interface

ENTER The Ethernet Interface Connected To The Adl Modemfor Solaris, this is Likey to Be Sometying Like /Dev/hme0.for Linux, IT Will Be Ethx, Where X Is A Number. (Default Eth0): ADSL Dial Used NIC, if There is only one network card, and the default value is used.

Do you want the link to come up on demand, or stay up continuously? If you want it to come up on demand, enter the idle time in secondsafter which the link should be dropped. If you want the link tostay up permanently, enter no (Two letters, lower-case.) Note: Demand-activated links do not interact well with dynamic ipaddresses. You may have some problems with demand value (Default no): By default

DNS

Please enter the IP address of your ISPs primary DNS server.If your ISP claims that the server will provide dynamic DNS addresses, enter server (all lower-case) here. If you just press enter, I will assume you know what you aredoing and Not Modify Your DNS Setup.Enter The DNS Information Here: Do not fill in any DNS address, ADSL automatically get DNS address from ISP PASSWORD

Please enter your password: Enter the password of the ADSL account please re-enter your password: password verification

UserCtrl

Please enter Yes (Two letters, Lower-case.) If you want to allownormal user to start or stop dsl connection (default yes): By default

FireWalling

. Please choose the firewall rules to use Note that these rules arevery basic You are strongly encouraged to use a more sophisticatedfirewall setup;. However, these will provide basic security If youare running any servers on your machine, you must choose NONE andset up firewalling. yourself. Otherwise, the firewall rules will denyaccess to all standard servers like Web, e-mail, ftp, etc. If youare using SSH, the rules will block outgoing SSH connections whichallocate a privileged source port.

The firewall choices are: 0 - NONE:.. This script will not set any firewall rules You are responsiblefor ensuring the security of your machine You are STRONGLYrecommended to use some kind of firewall rules.1 - STANDALONE: Appropriate for a basic stand-alone Web-surfing Workstation2 - Masquerade: Appropriate for a Machine Acting as an Internet GatewayFor a Lanchoose a type of firewall (0-2): So select 2, as a gateway

START THIS Connection At Boot Time

Do you want to start this connection at boot time? Please enter no or yes (Default no): If you are the month, choose Yes, then connect the network when starting.

** Summary of what you entered **

Ethernet Interface: eth1User name: usernameActivate-on-demand: NoDNS: Do not adjustFirewalling: MASQUERADEUser Control:?. YesAccept these settings and adjust configuration files (y / n) to select yes, save the settings adsl to this configuration, we use the command / SBIN / ADSL-Start to activate the ADSL connection, if your username and password are correct, it should be connected. You can also use the command / sbin / adsl-status to see the ADSL connection status if it appears:

adsl-status: Link is up and running on interface ppp0ppp0 Link encap: Point-to-Point Protocol inet addr: xxxx PtP: yyyy Mask: 255.255.255.255 UP POINTOPOINT RUNNING NOARP MULTICAST MTU: 1492 Metric: 1 RX packets: 8191 errors: 0 Dropped: 0 tx packets: 12153 errors: 0 Dropped: 0 overruns: 0 Carrier: 0 Collisions: 0 TXQUEUELEN: 3 RX BYTES: 7135851 (6.8 MB) TX bytes: 1083961 (1.0 MB) Connect the ADSL network. X.x.x.x indicates your IP address, y.y.y represents the ADSL gateway address. Open the browser to see if you can access the Internet. If still can't. Run the following command:

/ SBIN / ROUTE DEL Default / Sbin / Route Add Default GW y.y.y.y

Y.y.y is the ADSL gateway address, which can be seen in the previously described / sbin / adsl-status command. At this point, the PING external IP address should have no problem, and the unit can also be networked through the browser. Add the two sentences to /etc/rc.d/rc.local to ensure that the route correctly connects the network every time startup.

Configuration Sharing Internet: Modify / etc / sysconfig / iptables (delete the original content), the modification is as follows

# Firewall configuration written by petehero # Manual customization of this file is not recommended # Note:. Ifup-post will punch the current nameservers through the # firewall; such entries will * not * be listed here * mangle: PREROUTING ACCEPT [0:. 0]: Forward Accept [0: 0]: Output Accept [0: 0]: PostRouting Accept [0: 0] * Nat: preording accept [0: 0]: PostRouting accept [0: 0]: Output accept [0: 0] 192.168.0.0/255.255.255.0.0/255.255.255.0.0/255.255.255.0.0/255.255.255.0.0/255.255.255.0.0/255.255.255.0.0/255.255.255.0.0/255.255.255.0.0: 0: 0: Forward Accept [0: 0]: Output Accept [0: 0] Commit

Modify /etc/sysctl.conf, set Net.IPv4.ip_forward to 1, as follows: Net.IPv4.ip_forward = 1iptables -t nat -l -n See if the proxy rule is correct, the result is as follows: [Root @ localhost root] # iptables -t nat -l -n chain preloading (policy accept) Target Prot Opt Source Destination

Chain Post Opt Source Destinationmasquerade All - 192.168.0.0/24 0.0.0.0.0

Chain Output (Policy ACCEPT) Target Prot Opt Source Destination

CAT / PROC / SYS / NET / IPV4 / IP_FORWARD see if the value is 1, the results are as follows: [Root @ localhost root] $ cat / proc / sys / net / ipv4 / ip_forward 1

Stay up the Network service and iptables services, or you can complete the configuration directly.

If the client has set the IP address and DNS address, you can share the Internet through the server.

转载请注明原文地址:https://www.9cbs.com/read-13835.html

New Post(0)