We can configure Linux Server as a Router or Gateway so that we can establish connection between two different networks which are not directly connected with each other without any use of Routing/Gateway Device.
Objective
Objective
· We will create two subnet and will establish connection with two machines which are having different subnet’s IP Address and are not directly connected to each other. We will use Linux Operating System in both PCs and will also use Linux PC which will act as a Router to establish connection between two different networks
· We should be able to ping both machines from each other successfully
Requirements:
· Three Linux PCs. Two Linux PC with One NIC and One Linux PC with two NICs
· 2 No. of 8 Port Unmanaged Network Switch
Network Diagram
Configuration Details
· PC1 is connected to 8 port Switch as shown in network diagram.
· PC2 is connected to another 8 port Switch as shown in network diagram.
· ROUTERPC is connected to 8 port switch through ETH0 as shown in network diagram.
· ROUTERPC is connected to another 8 port switch through ETH1 as shown in network diagram.
· Network1 : 10.100.53.0/24
· Network2 : 10.100.50.0/24
· PC1 IP Address : 10.100.50.254
· PC2 IP Address : 10.100.53.254
· ROUTERPC’s ETH0 IP Address : 10.100.50.15
· ROUTERPC’s ETH1 IP Address : 10.100.53.16
Configuration Steps:
1) Assign IP Address 10.100.50.254 to PC1 as shown in below screenshot
2) Assign IP Address 10.100.53.254 to PC2 as shown in below screenshot
3) Assign IP Address 10.100.50.15 to ETH0 interface of ROUTERPC
5) Open /etc/sysctl.conf file in vi editor and set net.ipv4.ip_forward = 1 . This will enable IP forwarding/Routing on ROUTERPC as shown in below screenshot
7) Add static route on PC2 as shown below.
Expected Results:
1) PC1 should be able to get ping reply from ROUTERPC
2) PC1 should be able to get ping reply from PC2
3) PC2 should be able to get ping reply from ROUTERPC
4) PC2 should be able to get ping reply from PC1
5) PC1 should be able to traceroute to PC2 through ROUTERPC
6) PC2 should be able to traceroute to PC1 through ROUTERPC
Testing:
· Ping from PC1 ( 10.100.50.254 ) to ROUTERPC’s ETH0 interface IP ( 10.100.50.15) and Ping from PC1 ( 10.100.50.254 ) to ROUTERPC’s ETH1 interface IP ( 10.100.53.16) as shown in below screenshot
· Ping from PC2 ( 10.100.53.254 ) to ROUTERPC’s ETH0 interface IP ( 10.100.50.15) and Ping from PC2 ( 10.100.53.254 ) to ROUTERPC’s ETH1 interface IP ( 10.100.53.16) as shown in below screenshot
· Ping from PC1 ( 10.100.50.254 ) to PC2 ( 10.100.53.254 ) and Traceroute to PC2as shown in below screenshot and
· Ping from PC2 ( 10.100.53.254 ) to PC1 ( 10.100.50.254 ) Traceroute to PC1 as shown in below screenshot
Above exercise may helpful to all newbies who have just started using linux and want to gain more knowledge on linux. We can also use iptables to apply ACLs and security restrictions between two networks.
--
Sumit
--
Sumit
I follow your steps to configure linux server to interact with router. Each and every steps explain how to configure for linux server. website hosting
ReplyDeleteweb hosting
I configure linux server via router through your steps.if you establish means you can access different network connections through via router.website hosting
ReplyDeleteweb hosting