Debian Linux command to get into network interface card

#vi /etc/network/interfaces

How to assign multiple IP addresses in debian linux:

You can assign multiple IP addresses to the same network interface by using interface alias. This is useful if you need to have more than one server visible on the internet. Note that for multiple Apache servers you can use virtual hosts to add as many servers as you like with one single IP address.Apache simply utilises the domain name supplied by the client in the http host header.

You must turn off dhcp because you must use static assignment if you are configuring multiple IPs, so basically this file is:

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.1.90
gateway 192.168.1.1
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255

Assuming that you interface is eth0, you can assign three IP addresses editing /etc/network/interfaces similar to this:

# the loopback interface
auto lo
iface lo inet loopback

#
auto eth0
iface eth0 inet static
address 192.168.1.42
netmask 255.255.255.0
broadcast 192.168.1.255
gateway 192.168.1.1

auto eth0:0
iface eth0:0 inet static
address 192.168.1.41
netmask 255.255.255.0
broadcast 192.168.1.255

auto eth0:1
iface eth0:1 inet static
address 192.168.1.43
netmask 255.255.255.0
broadcast 192.168.1.255

auto eth0:2
iface eth0:2 inet static
address 192.168.1.44
netmask 255.255.255.0
broadcast 192.168.1.255

然后 /etc/init.d/networking restart

Last modification:July 14, 2020
如果觉得我的文章对你有用,请随意赞赏