This is an old revision of the document!
# cat /etc/hosts
127.0.0.1 localhost #192.168.X.1 gate.corpX.un gate #192.168.X.10 server.corpX.un server #192.168.X.30 client1.corpX.un client1 #192.168.100+X.10 lan.corpX.un lan 172.16.1.254 proxy 172.16.1.254 rep
# cat /etc/resolv.conf
search corpX.un nameserver 172.16.1.254
root@localhost:~# dmesg | grep eth root@localhost:~# cat /etc/udev/rules.d/70-my-net-names.rules
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="08:00:27:nn:nn:nn", NAME="eth0"
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="08:00:27:nn:nn:nn", NAME="eth1"
root@localhost:~# cat /etc/hostname
gate.corpX.un
root@localhost:~# cat /etc/network/interfaces
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.X.1
netmask 255.255.255.0
auto eth1
iface eth1 inet static
address 172.16.1.X
netmask 255.255.255.0
gateway 172.16.1.254
root@localhost:~# cat /etc/sysctl.conf
... net.ipv4.ip_forward = 1 ...
root@localhost:~# init 6 ... root@gate:~# apt update
root@localhost:~# dmesg | grep eth root@localhost:~# cat /etc/udev/rules.d/70-my-net-names.rules
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="08:00:27:nn:nn:nn", NAME="eth0"
root@localhost:~# cat /etc/hostname
server.corpX.un
root@localhost:~# cat /etc/network/interfaces
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.X.10
netmask 255.255.255.0
gateway 192.168.X.1
root@localhost:~# init 6 ... root@server:~# apt update
# cat /etc/rc.conf
hostname="gate.corpX.un" ifconfig_em0="192.168.X.1/24" ifconfig_em1="172.16.1.X/24" defaultrouter=172.16.1.254 gateway_enable=yes keyrate="fast" sshd_enable=yes
# init 6 # pkg update -f # pkg install pkg
# cat /etc/rc.conf
hostname="server.corpX.un" ifconfig_em0="192.168.X.10/24" defaultrouter=192.168.X.1 keyrate="fast" sshd_enable=yes
# init 6 # pkg update -f # pkg install pkg
cat gate.sh
rm /etc/udev/rules.d/70-persistent-net.rules
cat > /etc/hosts <<EOF
127.0.0.1 localhost
192.168.${1}.1 gate.corp${1}.un gate
172.16.1.254 proxy
172.16.1.254 rep
EOF
cat > /etc/resolv.conf <<EOF
search corp${1}.un
nameserver 172.16.1.254
EOF
echo gate.corp${1}.un > /etc/hostname
cat > /etc/network/interfaces <<EOF
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.${1}.1
netmask 255.255.255.0
auto eth1
iface eth1 inet static
address 172.16.1.${1}
netmask 255.255.255.0
gateway 172.16.1.254
EOF
echo net.ipv4.ip_forward = 1 >> /etc/sysctl.conf
cat server.sh
rm /etc/udev/rules.d/70-persistent-net.rules
cat > /etc/hosts <<EOF
127.0.0.1 localhost
192.168.${1}.10 server.corp${1}.un server
172.16.1.254 proxy
172.16.1.254 rep
EOF
cat > /etc/resolv.conf <<EOF
search corp${1}.un
nameserver 172.16.1.254
EOF
echo server.corp${1}.un > /etc/hostname
cat > /etc/network/interfaces <<EOF
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.${1}.10
netmask 255.255.255.0
gateway 192.168.${1}.1
EOF