Linux router configuration instance
Release date:2002-06-06
Abstract:
Author: Cold wind
Http://www.chinalinuxpub.com
Task: Use a Linux server to configure a router.
Objective: To achieve mutual access between two network segments: 192.168.1.0/24 and 192.168.2.0/24.
Steps:
1. Install a machine with dual NICs
2. Set eth0 address to 192.160.1.254 and eth1 address to 192.168.2.254:
# Ifconfig eth0 192.168.1.254 broadcast 192.168.1.255 netmask 255.255.255.0
# Ifconfig eth1 192.168.2.254 broadcast 192.168.2.255 netmask 255.255.255.0
3. Add route information:
# Route add-net 192.168.1.0 netmask 255.255.255.0 Dev eth0
# Route add-net 192.168.2.0 netmask 255.255.255.0 Dev eth1
4. Set the default gateway of all hosts in the 192.168.1.0/24 CIDR block to 192.168.1.254, and the default gateway of all hosts in the 192.168.2.0/24 CIDR block to 192.168.2.254.
5. Test