1 00:00:06,960 --> 00:00:08,790 - In this video I will tell you about 2 00:00:08,790 --> 00:00:10,500 run time network configuration, 3 00:00:10,500 --> 00:00:11,613 and how that works. 4 00:00:12,990 --> 00:00:14,730 So first you need to understand 5 00:00:14,730 --> 00:00:17,403 how nodes obtain an IP address. 6 00:00:18,480 --> 00:00:21,303 On servers, IP address configuration is set statically, 7 00:00:22,500 --> 00:00:25,503 using tools like NMCLI or NMTUI. 8 00:00:26,580 --> 00:00:29,100 On workstations, IP address configuration 9 00:00:29,100 --> 00:00:32,610 typically is handed out to a DHCP server. 10 00:00:32,610 --> 00:00:36,000 DHCP is Dynamic Host Configuration Protocol. 11 00:00:36,000 --> 00:00:37,950 That is a server that has been created by 12 00:00:37,950 --> 00:00:39,810 the owner of the network to make sure that 13 00:00:39,810 --> 00:00:42,690 if you connect to a network, you get an IP address. 14 00:00:42,690 --> 00:00:44,520 Which is the ID that you need in order 15 00:00:44,520 --> 00:00:46,563 to communicate on the local network. 16 00:00:47,550 --> 00:00:48,990 If you wanna do troubleshooting, 17 00:00:48,990 --> 00:00:51,123 the IP command is used to set, 18 00:00:52,229 --> 00:00:55,293 and check runtime network configuration. 19 00:00:56,490 --> 00:00:59,580 When I'm talking about runtime network configuration, 20 00:00:59,580 --> 00:01:01,440 what I mean is network configuration 21 00:01:01,440 --> 00:01:02,793 that is not persistent. 22 00:01:03,720 --> 00:01:07,500 In order to work with runtime network configuration, 23 00:01:07,500 --> 00:01:10,263 you need to know which tool you should use. 24 00:01:11,190 --> 00:01:13,530 Many people would say If config. 25 00:01:13,530 --> 00:01:16,740 Well I can tell you IF config is obsolete. 26 00:01:16,740 --> 00:01:18,840 It uses outdated methods for addressing 27 00:01:18,840 --> 00:01:20,598 and displaying networking, and for that reason 28 00:01:20,598 --> 00:01:24,090 doesn't display accurate information anymore. 29 00:01:24,090 --> 00:01:26,100 You should not use IF config, 30 00:01:26,100 --> 00:01:28,560 and on many distributions you won't 31 00:01:28,560 --> 00:01:30,780 even find IF config anymore. 32 00:01:30,780 --> 00:01:32,310 That's how it's supposed to be, 33 00:01:32,310 --> 00:01:34,890 because in the late 1990's, 34 00:01:34,890 --> 00:01:37,020 yes that's more than 20 years ago, 35 00:01:37,020 --> 00:01:40,290 the Linux network stack has changed significantly, 36 00:01:40,290 --> 00:01:42,480 and in order to deal with these significant 37 00:01:42,480 --> 00:01:45,030 changes, net tools was needed. 38 00:01:45,030 --> 00:01:50,010 And for that reason, IF config is obsolete right now. 39 00:01:50,010 --> 00:01:53,043 An IP is the main command for managing networking. 40 00:01:54,420 --> 00:01:55,560 Now here we have a demo, 41 00:01:55,560 --> 00:01:57,690 and in this demo I have listed 42 00:01:57,690 --> 00:02:00,120 the commands that you should know 43 00:02:00,120 --> 00:02:02,640 in order to troubleshoot and analyze 44 00:02:02,640 --> 00:02:05,190 your network configuration. 45 00:02:05,190 --> 00:02:06,993 Let me just demonstrate. 46 00:02:08,880 --> 00:02:10,533 So to start with I'm going to use 47 00:02:10,533 --> 00:02:13,500 sudo IP A. 48 00:02:13,500 --> 00:02:15,930 IP A in fact is short for 49 00:02:15,930 --> 00:02:18,750 IP ADDR show, 50 00:02:18,750 --> 00:02:20,010 but why would you want to type 51 00:02:20,010 --> 00:02:23,880 IP ADDR show if you can also type IP A. 52 00:02:23,880 --> 00:02:27,539 Look IP A is giving us the same. 53 00:02:27,539 --> 00:02:29,987 As you can see, we have ENS 33. 54 00:02:31,168 --> 00:02:35,160 ENS 33 is a network interface that I am using. 55 00:02:35,160 --> 00:02:38,610 Now if you want to add IP addresses in runtime, 56 00:02:38,610 --> 00:02:41,400 you use IP ADDR add DEV, 57 00:02:41,400 --> 00:02:44,070 followed by ENS 33 in this guys. 58 00:02:44,070 --> 00:02:46,200 And then you specify the IP address 59 00:02:46,200 --> 00:02:48,960 including the subnet mass that you want to use. 60 00:02:48,960 --> 00:02:51,312 Uh oh. Operation not permitted. 61 00:02:51,312 --> 00:02:55,740 Is that so? Of course because we need sudo superpowers 62 00:02:55,740 --> 00:02:58,770 in order to do something like this. 63 00:02:58,770 --> 00:03:01,470 Now if you want to verify that this was successful, 64 00:03:01,470 --> 00:03:04,740 sudo IP A, and that will show you 65 00:03:04,740 --> 00:03:07,830 the secondary IP address has been added. 66 00:03:07,830 --> 00:03:09,630 Hey how about IF config? 67 00:03:09,630 --> 00:03:11,700 I told you that's obsolete, I know. 68 00:03:11,700 --> 00:03:13,450 But I also know that some people 69 00:03:14,310 --> 00:03:15,870 are kind of attached to it. 70 00:03:15,870 --> 00:03:17,480 The problem with IF config is that 71 00:03:17,480 --> 00:03:20,373 IF config has never been reworked 72 00:03:20,373 --> 00:03:23,670 to address the IP stack in the right way. 73 00:03:23,670 --> 00:03:25,830 So if you use sudo IF config, 74 00:03:25,830 --> 00:03:29,160 you don't see the IP address that I just signed. 75 00:03:29,160 --> 00:03:32,700 It's here, but IF config just cannot show it. 76 00:03:32,700 --> 00:03:34,560 And in case you really don't believe, 77 00:03:34,560 --> 00:03:37,260 lets do a man IF config and there we go. 78 00:03:37,260 --> 00:03:39,603 This program is obsolete. 79 00:03:40,470 --> 00:03:41,996 Use IP ADDR, 80 00:03:41,996 --> 00:03:44,220 IP link instead. 81 00:03:44,220 --> 00:03:45,750 That's all about IF config. 82 00:03:45,750 --> 00:03:47,307 One more thing. 83 00:03:47,307 --> 00:03:51,180 IF config is obsolete on Linux, on all Linux distributions. 84 00:03:51,180 --> 00:03:54,120 If you are using Mac IOS, you might confuse 85 00:03:54,120 --> 00:03:55,771 Mac IOS for Linux. It is not. 86 00:03:55,771 --> 00:03:58,560 Mac IOS is a BXD Unix distribution. 87 00:03:58,560 --> 00:04:01,980 And on that operating system different rules apply. 88 00:04:01,980 --> 00:04:04,043 And one of these rules is that on 89 00:04:04,043 --> 00:04:08,700 Mac IOS IF config is still the default utility. 90 00:04:08,700 --> 00:04:10,410 But this course is about Linux, 91 00:04:10,410 --> 00:04:12,259 so IP it is. 92 00:04:12,259 --> 00:04:15,990 Now if your link is down then its not functional anymore. 93 00:04:15,990 --> 00:04:20,580 So probably direct the FURU sudo IP link, 94 00:04:20,580 --> 00:04:24,153 set ENS 33 up again. 95 00:04:25,020 --> 00:04:26,820 In some cases, this may help. 96 00:04:26,820 --> 00:04:29,040 Especially if you change some configuration 97 00:04:29,040 --> 00:04:30,363 that needs to be rewrote. 98 00:04:31,530 --> 00:04:33,488 Next up is IP route show. 99 00:04:33,488 --> 00:04:36,360 The thing is that in IP you have a routing table, 100 00:04:36,360 --> 00:04:38,460 and in the routing table at least 101 00:04:38,460 --> 00:04:40,380 you should have a default route. 102 00:04:40,380 --> 00:04:44,160 An IP route show allows you to see this default route. 103 00:04:44,160 --> 00:04:46,800 In case you do not have a default route 104 00:04:46,800 --> 00:04:50,250 then you can use IP route at default via. 105 00:04:50,250 --> 00:04:52,290 But you know what, I'm not going to do that. 106 00:04:52,290 --> 00:04:54,840 Because that would only confuse my IP stack. 107 00:04:54,840 --> 00:04:56,130 I have a default route. 108 00:04:56,130 --> 00:04:58,563 It's working so there's no need to change it.