Vernetzung mittels TCP/IP Linux statisch: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
Keine Bearbeitungszusammenfassung |
|||
| Zeile 6: | Zeile 6: | ||
auto enp0s3 | auto enp0s3 | ||
iface enp0s3 inet static | iface enp0s3 inet static | ||
address 10. | address 10.31.4.19/24 | ||
gateway 10. | gateway 10.31.4.1 | ||
auto enp0s8 | auto enp0s8 | ||
| Zeile 15: | Zeile 15: | ||
auto enp0s9 | auto enp0s9 | ||
iface enp0s9 inet static | iface enp0s9 inet static | ||
address | address 192.168.19.0/24 | ||
auto enp0s10 | auto enp0s10 | ||
iface enp0s10 inet static | iface enp0s10 inet static | ||
address | address 192.168.17.0/24 | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| Zeile 42: | Zeile 42: | ||
*'''vim /etc/hosts''' | *'''vim /etc/hosts''' | ||
<syntaxhighlight lang="yaml"> | <syntaxhighlight lang="yaml"> | ||
127.0.1.1 | 127.0.1.1 hack.lab firewall | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| Zeile 52: | Zeile 52: | ||
auto enp0s3 | auto enp0s3 | ||
iface enp0s3 inet static | iface enp0s3 inet static | ||
address 10. | address 10.31.4.19/24 | ||
gateway 10. | gateway 10.31.4.1 | ||
post-up iptables -t nat -A POSTROUTING -j MASQUERADE -o enp0s3 -s | post-up iptables -t nat -A POSTROUTING -j MASQUERADE -o enp0s3 -s 192.168.19.0/24 | ||
post-up iptables -t nat -A POSTROUTING -j MASQUERADE -o enp0s3 -s | post-up iptables -t nat -A POSTROUTING -j MASQUERADE -o enp0s3 -s 192.168.17.0/24 | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Version vom 15. Februar 2023, 12:32 Uhr
Ip Adresse an Interface binden
- Bearbeiten der Interfaces in /etc/network/interfaces
- vim /etc/network/interfaces
# The primary network interface
auto enp0s3
iface enp0s3 inet static
address 10.31.4.19/24
gateway 10.31.4.1
auto enp0s8
iface enp0s8 inet static
address 10.88.19.1/24
auto enp0s9
iface enp0s9 inet static
address 192.168.19.0/24
auto enp0s10
iface enp0s10 inet static
address 192.168.17.0/24Nameserver
Nameserver eintragen
- echo "nameserver 8.8.8.8" > /etc/resolv.conf
Search Domain
- echo "search kit.lab" >> /etc/resolv.conf
Forwarding einschalten
In der Datei /etc/sysctl.conf entfernen wir das Raute "#" Zeichen, um die Option "net.ipv4.ip_forward=1" zu aktivieren
- vim /etc/sysctl.conf
# Uncomment the next line to enable packet forwarding for IPv4
net.ipv4.ip_forward=1Hostname setzen
- Den Hostname setzen wir mit folgendem Befehl
- hostnamectl set-hostname firewall.kit.lab
- Wir ändern den Host in /etc/hosts
- vim /etc/hosts
127.0.1.1 hack.lab firewallMasquerade
- Bearbeiten der Interfaces Optionen des Interfaces "enp0s3" in der Datei "/etc/network/interfaces"
- vim /etc/network/interfaces
# The primary network interface
auto enp0s3
iface enp0s3 inet static
address 10.31.4.19/24
gateway 10.31.4.1
post-up iptables -t nat -A POSTROUTING -j MASQUERADE -o enp0s3 -s 192.168.19.0/24
post-up iptables -t nat -A POSTROUTING -j MASQUERADE -o enp0s3 -s 192.168.17.0/24