How to use Linux as router

In this article I will show you that how can you use Linux as a router. Routers are the devices those are used to connect ...

In this article I will show you that how can you use Linux as a router. Routers are the devices those are used to connect two different networks. Routers are very costly devices. Linux could be a cost effective solution of routing in a small company.
Exam question
Your system is going use as a router for 192.168.0.0/24 and 192.168.1.0/24. Enable the IP forwarding.

Linux as a Router

In this practical we are using three computers. One Linux system will be use for routing and reset two will remain in two different networks. First we will configure the system which is going to play the role of router.
How to create virtual LAN card

Configure server system

You need two LAN card for routing between two networks or you can create virtual LAN card instead of deploying them physically.
To create virtual Ethernet card change directory to /etc/sysconfig/network-scripts
change directory network script
ifcfg-eth0 is the necessary script file for Ethernet 0. Copy this file to the same folder to create new virtual LAN cards.
cp eth0 eth0.1
Now on this newly created virtual LAN card. It could be done by service network restart
service network restart
Run setup command and select network configuration sub window from list
setup
You have two LAN card here, select eth0 from list to assign IP
select eh0
This Ethernet card will be the default gateway of first network set its IP to 192.168.1.254 and click on ok
assign ip
Now select eth0.1 ( This our virtual LAN card which we create in our last sections)
select eth1
Set its IP to 192.168.0.254 This will be the default gateway of other network. Click on OK then quit and quit to come back on command prompt
assign ip eth1
IP forwarding can be enabled by editing in /etc/sysctl.conf file. open this file
vi /etc/sysctl.conf
Locate the net.ipv4. ip_forward = 0 tag. and replace the value 0 to 1. This will enable IP forwarding to permanently . But this require a system reboot.
change value sysctl.conf
If don't want to restart the system you can tell running kernel directly by echo command and kernel will enable the IP forwarding
echo command
now configure our client system. we are using two system one from each network to test the connectivity .
Our first system is a Linux machine run setup command on it
setup commands
assign its IP address to 192.168.0.1 with a default gateway of 192.168.0.254
assign IP address
now restart the network service and check connectivity form its default gateway ( Server IP)
ping
Now go on our other host which we are using a window machine ( You can also use Linux host ) and set IP address to 192.168.1.1 with a default gateway to 192.168.1.254
ip configurations
now open command prompt and test connectivity with default gateway
ping commands
At this point you have completed all necessary step's to enable routing its time to verify this

Test from windows system

ping the Linux host located on other network
ping replay

Test from Linux system

ping the Window host located on other network
ping replay

COMMENTS

Random Elites

Name

Common Linux Common Redhat Ip Address Redhat RHEL6 Ubuntu
false
ltr
item
Linux Elites: How to use Linux as router
How to use Linux as router
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgR3bbygRbS1Ihx5VBkzpLIwg58Xu4R3heWuxgrK9kIO4pPiLGUUvoWj9Z7r3psusyxlxS_TLiWSOKE3vbNMXRtAAKbEsS-Pwlurql4de4ap1rt0xPHXs2q_xblpif36AVB5Fu_07CByFU/s640/519470675_c_570_411.jpg
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgR3bbygRbS1Ihx5VBkzpLIwg58Xu4R3heWuxgrK9kIO4pPiLGUUvoWj9Z7r3psusyxlxS_TLiWSOKE3vbNMXRtAAKbEsS-Pwlurql4de4ap1rt0xPHXs2q_xblpif36AVB5Fu_07CByFU/s72-c/519470675_c_570_411.jpg
Linux Elites
https://linuxelites.blogspot.com/2016/03/how-to-use-linux-as-router.html
https://linuxelites.blogspot.com/
http://linuxelites.blogspot.com/
http://linuxelites.blogspot.com/2016/03/how-to-use-linux-as-router.html
true
7442208655518515278
UTF-8
Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS CONTENT IS PREMIUM Please share to unlock Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy