Open main menu

CDOT Wiki β

Changes

SRT210 Lab 3

1,636 bytes added, 11:48, 21 January 2019
PART 1: FIX IPTABLES MISTAKES
COMMIT</source>
* Then re-add the rules you created last week, and make them persistent by running <code>service iptables save</code>
 
= PART 2: NAT =
 
[https://www.systutorials.com/816/port-forwarding-using-iptables/ This website] has a decent overview of port forwarding.
 
* We'll set up your lin1 machine to be a web server accessible from the internet (in our case specifically that means accessible from the Seneca network).
* Create a text file on lin1 named index.html in the /var/www/html directory with the following contents (replace Andrew with your name):
<source>Hello, this is Andrew's web server on lin1.</source>
* Feel free to add as much HTML in there as you like.
* Confirm that:
** Apache on lin1 is running, and accessible from lin1.
** It's accessible from c7host
* Notice that if you try to access 192.168.210.11 from outside your vmware environment - there will not be a route to get to it.
* Try to go to the Seneca IP address of your c7host using a web browser on your VMware host (Windows for lab machines). That should also not work but at least you should have a route to it.
** Note that if you're using a laptop on wireless - you probably have your c7host network adapter set to NAT instead of bridged mode. If that's the case - you might need to modify some steps from this lab.
* Now we'll configure port forwarding so that any requests to TCP port 80 arriving at c7host will be forwarded to lin1:
<source>iptables -A PREROUTING -t nat -p tcp --dport 80 -j DNAT --to 192.168.210.11:80
iptables -I FORWARD -p tcp -d 192.168.210.11 --dport 80 -j ACCEPT</source>
* Don't just run those commands blindly - understand what they do.
* Try accessing your c7host from a web browser again. You should see the web page from your lin1 web server.
= PART 3: YOUR TASKS =