1. Port forwarding#advancedFirewalls can not only filter requests, they can also forward them.Requirements:Configure web-01 so that its firewall redirects port 8080/TCP to port 80/TCP.Your answer file should be a copy of the ufw configuration file that you modified to make this happenTerminal in web-01:root@03-web-01:~# netstat -lpnActive Internet connections (only servers)Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program nametcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 2473/nginxtcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 978/sshdtcp6 0 0 :::80 :::* LISTEN 2473/nginxtcp6 0 0 :::22 :::* LISTEN 978/sshdudp 0 0 0.0.0.0:68 0.0.0.0:* 594/dhclientudp 0 0 0.0.0.0:54432 0.0.0.0:* 594/dhclientudp6 0 0 :::32563 :::* 594/dhclientActive UNIX domain sockets (only servers)Proto RefCnt Flags Type State I-Node PID/Program name Pathunix 2 [ ACC ] SEQPACKET LISTENING 7175 433/systemd-udevd /run/udev/controlunix 2 [ ACC ] STREAM LISTENING 6505 1/init @/com/ubuntu/upstartunix 2 [ ACC ] STREAM LISTENING 8048 741/dbus-daemon /var/run/dbus/system_bus_socketunix 2 [ ACC ] STREAM LISTENING 8419 987/acpid /var/run/acpid.socketroot@03-web-01:~#root@03-web-01:~# grep listen /etc/nginx/sites-enabled/default listen 80 default_server; listen [::]:80 default_server ipv6only=on; # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000# listen 8000;# listen somename:8080;# listen 443;root@03-web-01:~#My web server nginx is only listening on port 80netstat shows that nothing is listening on 8080Terminal in web-02:ubuntu@03-web-02:~$ curl -sI web-01.holberton.online:80HTTP/1.1 200 OKServer: nginx/1.4.6 (Ubuntu)Date: Tue, 07 Mar 2017 02:14:41 GMTContent-Type: text/htmlContent-Length: 612Last-Modified: Tue, 04 Mar 2014 11:46:45 GMTConnection: keep-aliveETag: "5315bd25-264"Accept-Ranges: bytesubuntu@03-web-02:~$ curl -sI web-01.holberton.online:8080HTTP/1.1 200 OKServer: nginx/1.4.6 (Ubuntu)Date: Tue, 07 Mar 2017 02:14:43 GMTContent-Type: text/htmlContent-Length: 612Last-Modified: Tue, 04 Mar 2014 11:46:45 GMTConnection: keep-aliveETag: "5315bd25-264"Accept-Ranges: bytesubuntu@03-web-02:~$I use curl to query web-01.holberton.online, and since my firewall is forwarding the ports, I get a HTTP 200 response on port 80/TCP and also on port 8080/TCP.Repo:GitHub repository: alx-system_engineering-devopsDirectory: 0x13-firewallFile: 100-port_forwarding
Question
- Port forwarding#advancedFirewalls can not only filter requests, they can also forward them.Requirements:Configure web-01 so that its firewall redirects port 8080/TCP to port 80/TCP.Your answer file should be a copy of the ufw configuration file that you modified to make this happenTerminal in web-01:root@03-web-01:~# netstat -lpnActive Internet connections (only servers)Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program nametcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 2473/nginxtcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 978/sshdtcp6 0 0 :::80 :::* LISTEN 2473/nginxtcp6 0 0 :::22 :::* LISTEN 978/sshdudp 0 0 0.0.0.0:68 0.0.0.0:* 594/dhclientudp 0 0 0.0.0.0:54432 0.0.0.0:* 594/dhclientudp6 0 0 :::32563 :::* 594/dhclientActive UNIX domain sockets (only servers)Proto RefCnt Flags Type State I-Node PID/Program name Pathunix 2 [ ACC ] SEQPACKET LISTENING 7175 433/systemd-udevd /run/udev/controlunix 2 [ ACC ] STREAM LISTENING 6505 1/init @/com/ubuntu/upstartunix 2 [ ACC ] STREAM LISTENING 8048 741/dbus-daemon /var/run/dbus/system_bus_socketunix 2 [ ACC ] STREAM LISTENING 8419 987/acpid /var/run/acpid.socketroot@03-web-01:~#root@03-web-01:~# grep listen /etc/nginx/sites-enabled/default listen 80 default_server; listen [::]:80 default_server ipv6only=on; # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000# listen 8000;# listen somename:8080;# listen 443;root@03-web-01:~#My web server nginx is only listening on port 80netstat shows that nothing is listening on 8080Terminal in web-02:ubuntu@03-web-02:~ curl -sI web-01.holberton.online:8080HTTP/1.1 200 OKServer: nginx/1.4.6 (Ubuntu)Date: Tue, 07 Mar 2017 02:14:43 GMTContent-Type: text/htmlContent-Length: 612Last-Modified: Tue, 04 Mar 2014 11:46:45 GMTConnection: keep-aliveETag: "5315bd25-264"Accept-Ranges: bytesubuntu@03-web-02:~$I use curl to query web-01.holberton.online, and since my firewall is forwarding the ports, I get a HTTP 200 response on port 80/TCP and also on port 8080/TCP.Repo:GitHub repository: alx-system_engineering-devopsDirectory: 0x13-firewallFile: 100-port_forwarding
Solution
To configure port forwarding on web-01, follow these steps:
-
Open the ufw configuration file on web-01. You can do this by running the command
sudo nano /etc/ufw/before.rulesin the terminal. -
Scroll down to the section where the firewall rules are defined.
-
Add the following lines to redirect port 8080/TCP to port 80/TCP:
*nat :PREROUTING ACCEPT [0:0] -A PREROUTING -p tcp --dport 8080 -j REDIRECT --to-port 80 COMMIT -
Save the file and exit the text editor.
-
Restart the ufw firewall by running the command
sudo ufw reloadin the terminal.
Now, the firewall on web-01 will redirect any incoming requests on port 8080/TCP to port 80/TCP.
To verify that the port forwarding is working, you can use the netstat command on web-01. Running netstat -lpn will show the active internet connections. Look for a line that shows 0.0.0.0:8080 in the "Local Address" column, indicating that the port is being listened to.
Additionally, you can use the curl command on web-02 to test the port forwarding. Running curl -sI web-01.holberton.online:8080 should return a HTTP 200 response, indicating that the port forwarding is successful.
Please note that these instructions assume you have administrative privileges on web-01 and have the necessary permissions to modify the ufw configuration file.
Similar Questions
Which of the following allows hundreds of computers all to have their outbound traffic translated to a single IP? 1 pointPreservationRewritingOne-to-many NATPort forwarding
The Destination ports have standard ports such as the following except? A. HTTP B. FTP C. Telnet D. DNS
QuestionAn organization looks to make a server available to internet traffic without bringing harm to its private network. An onsite engineer configures a separate network for the server. Which approach does the engineer utilize?A.Port forwardingB.Port triggeringC.Inbound filteringD.Screened subnet
1.Question 1What ordering of TCP flags make up the Three-Way Handshake?1 pointSYN, SYN/ACK, ACKFIN, FIN/ACK, ACKSYN, ACK, FINSYN, ACK, SYN, ACK2.Question 2Transport layer protocols, like TCP and UDP, introduce the concept of a port. How many bits are in a port field?1 point3281643.Question 3A device that blocks traffic that meets certain criteria is known as a ________.1 pointHubFirewallRouterSwitch4.Question 4Which TCP flag is used to make the listening program respond immediately?1 pointURGACKRSTPSH5.Question 5_________are identified as ports 49152 through 65535.1 pointUser portsEphemeral portsSocketsSystem ports
explain forwarding and addressing in internet(network layer)
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.