Linux host transformed into a router

Source: Internet
Author: User

Lab environment:

Create four hosts on vmware:

Linux server A, linux Server B, client win7, and client server2008!

Ideas:

Server A adds two NICs, eth0 connects to vm1, and eth1 specifies vm2;

Connect to vm1 using win7 as the client of server;

Server B also specifies two NICs. eth0 connects to vm2 and eth1 connects to vm3;

Server2008 connects to vm3 as the client of server B.

Create an ftp server on server2008;

Enable win7 to connect to the ftp server.

1. After adding NICs to server A and server B, plan the network, modify the files/etc/sysconfig/network-scripts/ifcfg-eth0 and/etc/sysconfig/network-scripts/ifcfg-eth1 respectively:

Linux server to configure IP address see: http://murongqingqqq.blog.51cto.com/2902694/1364016

[Root @ aaa ~] # Cat/etc/sysconfig/network-scripts/ifcfg-eth0

# Intel Corporation 82545EM Gigabit Ethernet Controller (Copper)

DEVICE = eth0

BOOTPROTO = none

# HWADDR = 00: 0C: 29: CD: 14: F3

MACADDR = 00: 0C: 29: CD: 14: 22

ONBOOT = yes

IPADDR = 192.168.10.254

NETMASK = 255.255.255.0

[Root @ aaa ~] # Cat/etc/sysconfig/network-scripts/ifcfg-eth1

# Intel Corporation 82545EM Gigabit Ethernet Controller (Copper)

DEVICE = eth1

BOOTPROTO = none

ONBOOT = yes

HWADDR = 00: 0c: 29: cd: 14: fd

IPADDR = 192.168.20.1

NETMASK = 255.255.255.0

[Root @ aaa ~] #

2. network connection information on server B:

[Root @ zhangsp ~] # Cat/etc/sysconfig/network-scripts/ifcfg-eth0

# Intel Corporation 82545EM Gigabit Ethernet Controller (Copper)

DEVICE = eth0

BOOTPROTO = none

# HWADDR = 00: 0C: 29: 82: 09: E9

MACADDR = 00: 0C: 29: 82: 09: E8

ONBOOT = yes

IPADDR = 192.168.20.2

NETMASK = 255.255.255.0

[Root @ zhangsp ~] # Cat/etc/sysconfig/network-scripts/ifcfg-eth1

# Intel Corporation 82545EM Gigabit Ethernet Controller (Copper)

DEVICE = eth1

BOOTPROTO = none

ONBOOT = yes

HWADDR = 00: 0c: 29: 82: 09: f3

IPADDR = 192.168.30.254

NETMASK = 255.255.255.0

[Root @ zhangsp ~] #

3. Create the/etc/sysconf/static-routes file on server A and server B to specify A permanent static route with the following content:

Static-routes file on A: any net 192.168.30.0/24 gw 192.168.20.2

Static-routes file on B: any net 192.168.10.0/24 gw 192.168.20.1

4. Enable route forwarding for linux Hosts

Modify the/etc/sysctl. conf file on server A and server B respectively, and change ipv4 forwarding 0 to 1.

Run the sysctl-p command to make it take effect.

5. Restart the network service on server A and server B:

Service network restart

6. Modify the IP addresses of the win7 and server2008 hosts respectively;

IP address planning for win7 HOST: 192.168.10.1 255.255.255.0 Gateway: 192.168.10.254

Server Host IP Address: 192.168.30.1 255.255.255.0 Gateway: 192.168.30.254

7. Create an ftp service on the server2008 host and log on to the win7 host to verify whether the ftp service is successful.

For verification, you can directly use the ping command for verification;

If no error occurs, the access is successful!

This article is from the "Forest blog" blog, please be sure to keep this source http://murongqingqqq.blog.51cto.com/2902694/1363519

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.