Форум программистов «Весельчак У»
  *
Добро пожаловать, Гость. Пожалуйста, войдите или зарегистрируйтесь.
Вам не пришло письмо с кодом активации?

  • Рекомендуем проверить настройки временной зоны в вашем профиле (страница "Внешний вид форума", пункт "Часовой пояс:").
  • У нас больше нет рассылок. Если вам приходят письма от наших бывших рассылок mail.ru и subscribe.ru, то знайте, что это не мы рассылаем.
   Начало  
Наши сайты
Помощь Поиск Календарь Почта Войти Регистрация  
 
Страниц: [1]   Вниз
  Печать  
Автор Тема: debian два ip на одном сетевом интерфейсе  (Прочитано 26689 раз)
0 Пользователей и 1 Гость смотрят эту тему.
Sla
Модератор

ua
Offline Offline
Пол: Мужской

WWW
« : 25-08-2010 11:28 » 

Дружестенная радиостанция хочет запустить еще один радиопоток со своего сервера.
Т.к. за подключение второго порта нужно что-то платить, то я им предлагаю второй айпишник на существующем интерфейсе.
На freeBsd я это поднимал легко и сервер был под рукой, здесь же - сервер где-то далеко и доступ ограничен.


# ifconfig eth0
eth0      Link encap:Ethernet  HWaddr 00:1a:4d:51:f5:8d
          inet addr:AAA.BBB.CCC.DDD  Bcast:255.255.255.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:808799950 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1431742635 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:487699184 (465.1 MiB)  TX bytes:1503135941 (1.3 GiB)
          Interrupt:219 Base address:0xe000

#ifconfig eth0:1 AAA.BBB.CCC.DDE 255.255.255.0


# cat /etc/network/interfaces
Цитата
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug eth0
auto eth0
iface eth0 inet static
address AAA.BBB.CCC.DDD
network AAA.BBB.CCC.0
netmask 255.255.255.0
broadcast 255.255.255.255
gateway AAA.BBB.CCC.1
добавляю строки

Цитата
auto eth0:1
iface eth0:1 inet static
address AAA.BBB.CCC.DDE
network AAA.BBB.CCC.0
netmask 255.255.255.0
broadcast 255.255.255.255
gateway AAA.BBB.CCC.1
Это на будущее.

Поднимаю alias

#ifconfig eth0:1 up


Правильно???
Записан

Мы все учились понемногу... Чему-нибудь и как-нибудь.
RXL
Технический
Администратор

ru
Offline Offline
Пол: Мужской

WWW
« Ответ #1 : 25-08-2010 13:13 » 

ip address add dev eth0 1.2.3.4/24

Это в динамике, а вот чтобы сохранить в конфигах... Слав, понятия не имею, как это в Debian-like дистрибутивах делается - я с RH работаю.
Записан

... мы преодолеваем эту трудность без синтеза распределенных прототипов. (с) Жуков М.С.
McZim
Модератор

ru
Offline Offline
Пол: Мужской
Я странный


WWW
« Ответ #2 : 26-08-2010 04:39 » 

Configuring Static IP address for your network card

If you want to configure Static IP address you need to edit the /etc/network/interfaces and you need to enter the following lines replace eth0 with your network interface card

#vi /etc/network/interfaces

# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.3.90
gateway 192.168.3.1
netmask 255.255.255.0
network 192.168.3.0
broadcast 192.168.3.255

After entering all the details you need to restart networking services using the following command

#/etc/init.d/networking restart

Setting up Second IP address or Virtual IP address in Debian

If you are a server system administrator or normal user some time you need to assign a second ipaddress to your Ubuntu machine.For this you need to edit the /etc/network/interfaces file and you need to add the following syntax.Below one is the only example you need to chnage according to your ip address settings

#vi /etc/network/interfaces

auto eth0:1
iface eth0:1 inet static
address 192.168.1.60
netmask 255.255.255.0
network x.x.x.x
broadcast x.x.x.x
gateway x.x.x.x

You need to enter all the details like address,netmask,network,broadcast and gateways values after entering all the values save this file and you need to restart networking services in debian using the following command to take effect of our new ipaddress.

After entering all the details you need to restart networking services using the following command

#/etc/init.d/networking restart
Записан

The CBO without stats is like a morning without coffee. (c) T.Kyte.
tregrave
Новенький

ru
Offline Offline

« Ответ #3 : 24-07-2014 12:50 » new

Из Wiki Debian

Этот текст в /etc/network/interfaces назначает три IP адреса для eth0.

auto eth0
allow-hotplug eth0
iface eth0 inet static
    address 192.168.1.42
    netmask 255.255.255.0
    gateway 192.168.1.1

iface eth0 inet static
    address 192.168.1.43
    netmask 255.255.255.0

iface eth0 inet static
    address 192.168.1.44
    netmask 255.255.255.0

# также возможно добавить IP адрес из другой подсети
iface eth0 inet static
    address 10.10.10.14
    netmask 255.255.255.0
Записан
Страниц: [1]   Вверх
  Печать  
 

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines