In this lecture, we'll talk about the VIP table comment i.p table is the userspace component used to
configure a net filter the kernel framework that does the actual filtering, except that IP table belongs
to userspace and net filter belongs to Colonel Space so we can interact with that filter using the IP
tables comment.
There are also some graphical fronts for net filter that allow us to create rules, however, they lack
the flexibility of using a command line, and Linux professionals rely heavily on the IP table segment,
which has many, many options.
It is also important to know that IP tables can be run only by a good.
Let's move on and see what is the general syntax of IP tables.
After a VIP table comment comes at the table, namely the table name indicates the net filter table
on which the comment operates, by default, it's the filter table.
Comment or option indicates the operation we perform on a chain of that table.
Either long or short options are allowed.
For example, we append a goal to the end of the.
We supply a rule on a specific position.
We flush all the rules of a specific chain and table, or we simply point out all the rules of watching
equal his making and an action component.
The mixing part of a rule specifies the criteria that a packet must meet in order for the associated
action or target to be executed.
A mix is something that specifies a special condition within the packet that must be true or false,
and a single rule can contain several mixes and the entire condition is to if all the matches are true,
for example, we may want to make packets that come from a specific host or network and are going to
some parts on our system.
If any of these matches fails, for example, the source address is incorrect, but everything else
is true.
The whole rule fails in the next list is tested on the packet.
But if all makes these are true, the target specified by the rule is applied.
Then comes minus G and the target, the target specifies what action is taken on packets mixing the
criteria of the rule.
Examples of targets archtop, accept, log or masquerade will dive deeper into targets in a dedicated
section.
Enough talking.
Let's go to a terminal and write summary.
A table source.
Before starting writing rules, don't forget that only you can run VIP tables come in, you need good
access in order to configure a net filter or run the VIP tables.
Come in if you try to run the AP tables.
Comment is a non user fee.
You'll get the permission denied there.
I've executed the IP tables.
Comment is a non good user and I've got a permission denied there.
It seems very clear that I must build.
And I'm becoming glued by running through those, so
now I'm good.
Let's run the same comment is Ruth.
OK, there is no air.
By the way, the commander lifts the filter table, which is the default for input output and for our
things, if you want to see the rules from other tables, you should specify the table using minus the
option.
Like this IP table is minus the minus L.
It has displayed to the actions of the net people.
OK.
In the next example, I want to add the to filter table and input chain that drops incoming pink packets.
First, I'm checking that pink is working pink and the IP address of Linux one.
This is another Linux host and its host name is Linux, too, so Pink and the IP address of the other
Linux operating system.
Expen, at the end.
Ping is working and now Duggal IP Tablers, I am adding the rule to the filter table filter minus a,
I am appending the rule to the input chain.
And the matches the protocol is ICMP minus minus ICMP type I'm making on the ICMP type Akko.
There are more messages in the ICMP protocol, and I am dropping only echo or echo request packets minus
G drop ping is still working and I'm hitting enter.
OK, he twangs acoa request, not echo.
Perfect.
And we notice how Ping stopped.
Let's list the contents of the final IP table minus Al.
Or IP table is minus V and L, I want to see more information and there are 30 packets mixed by the
whole.
The same rule could be applied without the minus the filter option, the filter table is the default.
It's the same.
Let's try another rule.
I want to deny access from this Linux host to a specific website like, say, W-W that Ubuntu dot com.
Let's think about this requirement and split the role in more parts.
What table are we using?
And the answer is filter, because we are filtering traffic, we are not doing that or something else.
So IP is my nasty filter.
What IP tables comment or option are we going to specify?
And the answer is minus a from up and we are going to append a new rule to the table.
What chain will be used to make the pick?
This is outgoing traffic and it always means output.
And now come the.
What makes these are required for this kind of traffic.
So this is DCP traffic minus P from protocol.
Tsipi minus minus depart 80.
The traffic is going to port 80 and minus D, the destination IP address w w w dot ubuntu dot com.
And what target or action we perform on the Mixtepec.
And of course X drop minus G drop G means to jump to the specific target or to the following action
when the packet mixes against these small targets are always written in uppercase letters.
Before hitting enter, I want to check that the Web page is loading.
And the pages are loading, we notice here that it uses GPS and that means Port 443.
So I'm hitting enter and I'm adding another rule that drops back to port four hundred forty three.
So, in fact, these two rules will block traffic to Port 80 or Port 443.
Let's reload the page.
And we notice that the page is not loading any more.
If we leased the fire using my nacelle option and we end.
OK, we see the IP table rules and a lot of mixed packets on the output chain.
All of these IP addresses are of www.youtube.com and have been obtained from the DNS server.
And we see a lot of mixed or dropped packages.