Esempio di Makefile base:
all: main
CC = g++
OBJS = *.o
main: functions.o main.o
$(CC) -o main $(OBJS)
clean:
rm -rf *.o
Utilizzo:
- make: esegue ciò che è indicato in all (make main)
- make main: esegue il make main
- make clean: esegue il make clean
Libreria
Comandi:
g++ -c functions.cpp
ar rvs functions.lib functions.o
g++ -p mylibtest main.cpp functions.lib
./mylibtest
La creazione della libreria consente di "evitare" di includere nel package il file functions.cpp: una volta creata la libreria "rinominare" o "eliminare" il file functions.cpp in modo da verificarne il funzionamento
Assume that we want to PERMIT the ping from 192.168.2.100 to 192.168.1.0
Assume that we want to DENY the ping from 192.168.2.101 to 192.168.1.0
With using the Standard ACL we are "closest to the destination" and this means that we need to work on:
- R0 (closest to the destination)
- Gig0/1 on R0 (closest to the destination) outbound
the command to use in order to configure an access list that DENY 192.168.2.101 to reach 192.168.1.0 is:
access-list 1 deny 192.168.2.101 0.0.0.0
Please note that 0.0.0.0 is the wildcard which means basically that we deny ONLY 192.168.2.101;
we could also write this specific command in this way:
access-list 1 deny host 192.168.2.101
in case we want to deny ALL 192.168.2.0 we should put 0.0.0.255
In order to permit everything else:
access-list 1 permit any
R0:
access-list 1 deny 192.168.2.101 0.0.0.0
access-list 1 permit any
It is necessary to associate the created ACL to the correct interface:
interface gigabitEthernet 0/1
ip access-group 1 outbound
In case we want to "append" the deny for host 192.168.2.100 with a similar command like the one before, it won't work
What happens is that all access-list are read from top to bottom therefore the "permit" will mask the last one inserted.
The rule is that once a match occurs the access-list exits
Please consider that at the end of every access-list there's a default deny all
In order to reset the access-list 1 we can type:
no access-list 1
Extended ACL
Assume that we want to DENY all traffic from 192.168.2.102 wherever
With using the Extended ACL we are "closest to the source" and this means that we need to work on:
- R1 (closest to the source)
- Gig0/1 on R0 (closest to the source) inbound
R1(config)#ip access-list extended 100
R1(config-ext-nacl)#deny icmp host 192.168.2.102 any
R1(config-ext-nacl)#permit icmp any any
R1(config-ext-nacl)#exit
R1(config)#int g0/1
R1(config-if)#ip access-group 100 in
An ACL is a series of commands that control whether a router forwards or drops packets based on information found in the packet header.
ACL’s can perform the following tasks:
Limit network traffic to increase network performance. For example, video traffic could be blocked if it’s not permitted.
Provide traffic flow control. ACLs can help verify routing updates are from a known source.
ACLs provide security for network access and can block a host or a network.
Filter traffic based on traffic type such as Telnet traffic.
Screen hosts to permit or deny access to network services such as FTP or HTTP.
An ACL is a sequential list of permit or deny statements, known as access control entries (ACEs) commonly called ACL statements.
When network traffic passes through an interface configured with an ACL, the router compares the information within the packet against each ACE, in sequential order, to determine if the packet matches one of the ACEs; this is referred to as packet filtering.
The last statement of an ACL is always an implicit deny. This is automatically inserted at the end of each ACL and blocks all traffic. Because of this, all ACLs should have at least one permit statement.
ACLs can be configured to apply to inbound traffic and outbound traffic:
Inbound ACLs – Incoming packets are processed before they are routed to the outbound interface (coming into the router)
Outbound ACLs – Incoming packets are routed to the outbound interface, and then they are processed through the outbound ACL (coming out of the router)
The proper placement of an ACL can make the network operate more efficiently. For example, and ACL can be placed to reduce unnecessary traffic. Every ACL should be placed where it has the greatest impact on efficiency.
Standard Access List (ACL)
Since standard ACLs do not specify destination addresses, they should be configured as close to the destination as possible.
id: (1-99)
denies or permits source IP address
Extended Access List (ACL)
Configure extended ACLs as close as possible to the source of the traffic to be filtered. This will prevent undesirable traffic as close to the source without it crossing the network infrastructure.
in the .replit file change the 1st row with the following: compile = “clang -std=c++11 -lncurses main.cpp -o main”
in the replit.nix file add the following: pkgs.ncurses
now you can include in your main.cpp file: #include <ncurses.h>
remove the <iostream.h> and test with printf(“Hello world”);
BEWARE
It is possible that the code still has the ccls error (red underlined error) but the code works when it runs and if closing and re-opening the project it should disappear
It is possible to use “panel.h”
STEPS
you can include in your main.cpp file: #include <panel.h>
in the .replit file change the 1st row with the following: compile = “clang -std=c++11 –lpanel -lncurses main.cpp -o main”
Ncurses Introduzione e configurazione in replit.com