1 00:00:00,05 --> 00:00:03,00 - [Voiceover] In this lesson, we'll be changing 2 00:00:03,00 --> 00:00:06,01 our Ubuntu router host operating system settings 3 00:00:06,01 --> 00:00:09,05 to forward packets from its internal network interface 4 00:00:09,05 --> 00:00:12,07 to the external network interface. 5 00:00:12,07 --> 00:00:16,09 This allows us to forward packets from the Ubuntu host 6 00:00:16,09 --> 00:00:21,05 connected to the router host to the internet. 7 00:00:21,05 --> 00:00:23,06 Let's start by checking 8 00:00:23,06 --> 00:00:26,00 the current operating system settings. 9 00:00:26,00 --> 00:00:36,03 Type more forward slash proc sys forward slash net 10 00:00:36,03 --> 00:00:45,08 forward slash ipv4 forward slash IP underscore forward 11 00:00:45,08 --> 00:00:51,04 press enter and the output is zero. 12 00:00:51,04 --> 00:00:55,03 Zero in computer science means false. 13 00:00:55,03 --> 00:00:59,02 What this indicates is that at the operating system level 14 00:00:59,02 --> 00:01:02,08 forwarding is disabled. 15 00:01:02,08 --> 00:01:06,03 By the way "More" is a Linux command to show 16 00:01:06,03 --> 00:01:08,04 the content of a file. 17 00:01:08,04 --> 00:01:11,06 Now our mission is to enable forwarding. 18 00:01:11,06 --> 00:01:13,04 To accomplish this mission 19 00:01:13,04 --> 00:01:19,07 all you have to do is set the proc sys net ipv4 20 00:01:19,07 --> 00:01:24,01 IP underscore forward variable to one. 21 00:01:24,01 --> 00:01:25,07 How do you do that? 22 00:01:25,07 --> 00:01:28,04 You use the echo command. 23 00:01:28,04 --> 00:01:30,08 The echo command takes an input 24 00:01:30,08 --> 00:01:33,00 and outputs the same thing. 25 00:01:33,00 --> 00:01:38,06 Type echo space one. 26 00:01:38,06 --> 00:01:40,02 If you press enter 27 00:01:40,02 --> 00:01:44,02 the command will print the input, which is one. 28 00:01:44,02 --> 00:01:46,01 Press enter. 29 00:01:46,01 --> 00:01:49,02 One is printed as predicted. 30 00:01:49,02 --> 00:01:54,06 Before going any further let's sign in as root first 31 00:01:54,06 --> 00:01:57,01 because the command we're about to use 32 00:01:57,01 --> 00:01:59,08 requires route access. 33 00:01:59,08 --> 00:02:05,06 Type pseudo dash I. 34 00:02:05,06 --> 00:02:08,01 Press enter. 35 00:02:08,01 --> 00:02:16,01 Type echo one space and the greater than sign. 36 00:02:16,01 --> 00:02:18,00 The greater than sign in this case 37 00:02:18,00 --> 00:02:21,00 is called redirection in Linux 38 00:02:21,00 --> 00:02:24,08 and means that whatever is coming from the previous command 39 00:02:24,08 --> 00:02:28,00 is going to be passed to the next command. 40 00:02:28,00 --> 00:02:36,08 Type forward slash proc sys forward slash net 41 00:02:36,08 --> 00:02:48,04 forward slash ipv4 forward slash IP underscore forward. 42 00:02:48,04 --> 00:02:50,09 Press enter. 43 00:02:50,09 --> 00:02:53,07 Essentially what just happened here 44 00:02:53,07 --> 00:02:55,09 is the IP underscore forward variable 45 00:02:55,09 --> 00:03:00,02 is set to the value passed by echo one. 46 00:03:00,02 --> 00:03:03,00 The initial value was zero. 47 00:03:03,00 --> 00:03:06,03 Therefore the new IP underscore forward value 48 00:03:06,03 --> 00:03:09,01 should now be set to one. 49 00:03:09,01 --> 00:03:13,04 Let's see if the value has been actually changed. 50 00:03:13,04 --> 00:03:32,00 type more space proc sys net ipv4 IP underscore forward 51 00:03:32,00 --> 00:03:34,04 and press enter. 52 00:03:34,04 --> 00:03:39,06 As you can see, the value is now set to one. 53 00:03:39,06 --> 00:03:41,08 If you're using Azure VMs 54 00:03:41,08 --> 00:03:45,02 please don't forget to enable IP forwarding 55 00:03:45,02 --> 00:03:47,09 in the VM setting too. 56 00:03:47,09 --> 00:03:51,00 Now we are ready to move on to the next step 57 00:03:51,00 --> 00:03:55,00 which is changing the net filter settings.