Quick guide Debian/Ubuntu Setting up a IPv4 address subsequently on an IPv6 server

vs2-free-users

Active Member
Joined
Jun 8, 2023
Messages
195
Reaction score
94
Credits
1,310
Quick guide Debian/Ubuntu Setting up a IPv4 address subsequently on an IPv6 server

Preparation

Get IPv4 data from the provider (for a vs2-free under Contract->Server->IPv4-Addresses)

You need:

  • IP-Address
  • Net mask
  • Gateway
  • MAC-Address (only for additional ips)

Main IPv4 setup

  • Log in to the server via SSH
  • Create a backup copy of the file
Code:
cp -a /etc/network/interfaces /etc/network/interfaces.backup
- Open the file
Code:
/etc/network/interfaces

- Search for Line
Code:
iface lo inet loopback
- Add the following lines below
Code:
iface eth0 inet static
address [IP-Address]
netmask [Net mask]
up ip route add [Gateway] dev eth0
up ip route add default via [Gateway]
down ip route del default via [Gateway]
down ip route del [Gateway] dev eth0
- Replace
  • [IP-Address] with IP-Address
  • [Net mask] with Net mask
  • [Gateway] with Gateway

  • Save the file
  • Restart the server


Setting up additional IPv4

- Search for the interface matching the MAC-Address, enter the command
Code:
ip addr

and search for
link/ether [MAC-Address]

the line above begins with the appropriate interface, e.g. ethv0 or ethv1

  • Make a note of the interface
  • Make a backup copy of the file
Code:
cp -a /etc/network/interfaces /etc/network/interfaces.backup
- Open the file
Code:
/etc/network/interfaces
  • Go to the end of the file
  • Add the following lines below
Code:
iface [Interface] inet static
address [IP-Address]
netmask [Net mask]
- Replace
  • [IP-Address] with IP-Address
  • [Net mask] with Net mask
  • [Interface] through the interface matching the MAC-Address

  • Save the file
  • Restart the server
 
Last edited:



Members online


Top