Network Ubuntu 22 04 2
Network Ubuntu 22 04 2
Network Ubuntu 22 04 2
2
Instalación de servicio telnet
sudo apt-get install telnetd
sudo apt-get install -y ssh
INTRODUCCIÓN
• Netplan ( Ubuntu 17 en adelante)
Antes: ifconfig, traceroute, route….
Ahora: ip address show, ip route show
• YAML
Antes: /etc/network/interfaces
Ahora: /etc/netplan
nano 00-installer-config.yaml
2 servicios
- Network-Manager (se utiliza en el entorno grafico es todo automático)
- Systemd-networkd (es para modo server en comando)
1) Direccionamiento dinámico
network:
ethernets:
ens33:
dhcp4: true
version: 2
2) Direccionamiento estático
network:
ethernets:
enp0s3:
dhcp4: false
addresses: [192.168.1.202/24]
gateway4: 192.168.1.1
nameservers:
addresses: [8.8.8.8,8.8.4.4,192.168.1.1]
version: 2
network:
version: 2
renderer: networkd
ethernets:
enp0s8:
addresses: [172.172.1.60/24]
gateway4: 172.172.1.1
nameservers:
search: [hpr.plus]
addresses: [1.1.1.1, 1.0.0.1]
network:
version: 2
renderer: networkd
ethernets:
enp0s3:
addresses: [192.168.1.80/24]
gateway4: 192.168.1.1
nameservers:
search: [redes.plus]
addresses: [8.8.8.8, 8.8.4.4]
enp0s8:
addresses: [172.172.1.90/24]
gateway4: 172.172.1.1
nameservers:
search: [hpr.plus]
addresses: [1.1.1.1, 1.0.0.1]
network:
version: 2
ethernets:
enp0s3:
dhcp4: yes
dhcp4-overrides:
route-metric: 100
enp0s8:
dhcp4: yes
dhcp4-overrides:
route-metric: 200
network:
version: 2
renderer: networkd
ethernets:
ens33:
addresses: [192.168.152.105/24]
gateway4: 192.168.152.1
nameservers:
addresses: [200.87.100.10, 8.8.8.8]
network:
version: 2
renderer: networkd
ethernets:
ens33:
addresses: []
dhcp4: true
optional: true
bridges:
br0:
addresses: [ 192.168.152.105/24 ]
gateway4: 192.168.152.1
nameservers:
addresses: [200.87.100.10, 8.8.8.8]
dhcp4: false
interfaces:
- ens33
allowManaged=1
allowGlobal=0
allowDefault=0
allowDNS=0 (modificar los parámetros a 0)
#!/bin/bash
PATH="/bin:/sbin:/usr/bin:/usr/sbin"
export PATH
LOCAL_IF="ens33"
VPN_IF=" zthnhcgt44 "
BR_IP="192.168.152.105/24"
BR_NET="192.168.152.0/24"
date
# esperem fins que la interficie existeixi
while [ ! -e "/sys/class/net/$VPN_IF" ];
do
sleep 2;
done
# bridge
#brctl addbr br0
#brctl addif br0 $LOCAL_IF
brctl addif br0 $VPN_IF
brctl setfd br0 0
#brctl setmaxage br0 0
# ip
#ifconfig $LOCAL_IF 0.0.0.0
#ifconfig $VPN_IF 0.0.0.0
#ifconfig br0 $BR_IP
#ifconfig $LOCAL_IF up
#ifconfig $VPN_IF up
#ifconfig br0 up
# route
#ip route add $BR_NET dev br0
# iptables
iptables -I FORWARD -i $VPN_IF -j ACCEPT
iptables -I FORWARD -o $VPN_IF -j ACCEPT
iptables -I FORWARD -i br0 -j ACCEPT
iptables -I FORWARD -o br0 -j ACCEPT
iptables -I FORWARD -i $LOCAL_IF -j ACCEPT
iptables -I FORWARD -o $LOCAL_IF -j ACCEPT