Vernetzung mittels TCP/IP Linux statisch: Unterschied zwischen den Versionen

Aus Xinux Wiki
Zur Navigation springen Zur Suche springen
Zeile 31: Zeile 31:
 
*'''sysctl -w net.ipv4.ip_forward=1'''
 
*'''sysctl -w net.ipv4.ip_forward=1'''
 
=Hostname setzen=
 
=Hostname setzen=
 +
*Den Hostname setzen wir mit folgendem Befehl
 
*'''hostnamectl set-hostname  firewall.kit.lab'''
 
*'''hostnamectl set-hostname  firewall.kit.lab'''
 +
*Wir ändern den Host in /etc/hosts
 +
*'''vim /etc/hosts'''
 +
<syntaxhighlight>
 +
127.0.1.1    firewall.kit.lab    firewall
 +
</syntaxhighlight>
  
 
=Masquerade=
 
=Masquerade=
 
*'''iptables -t nat -A POSTROUTING -j MASQUERADE -o eth0 -s 192.168.240.67/24'''
 
*'''iptables -t nat -A POSTROUTING -j MASQUERADE -o eth0 -s 192.168.240.67/24'''

Version vom 15. Februar 2023, 09:35 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.81.1.19/19
 gateway 10.81.0.1

auto enp0s8
iface enp0s8 inet static
 address 10.88.19.1/24

auto enp0s9
iface enp0s9 inet static
 address 172.16.19.1/24

auto enp0s10
iface enp0s10 inet static
 address 172.17.19.1/24

Nameserver

Nameserver eintragen

  • echo "nameserver 8.8.8.8" > /etc/resolv.conf

Search Domain

  • echo "search hack.lab" >> /etc/resolv.conf

Forwarding einschalten

  • sysctl -w net.ipv4.ip_forward=1

Hostname 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    firewall.kit.lab    firewall

Masquerade

  • iptables -t nat -A POSTROUTING -j MASQUERADE -o eth0 -s 192.168.240.67/24