LinuxForum.Fans
Тема

Не перезапускаются сетевые интерфейсы

Автор: genialen 5 сообщений 2749 просмотров
#148175

uname -a
Linux debian1 2.6.32-5-686 #1 SMP Tue Mar 8 21:36:00 UTC 2011 i686 GNU/Linux
Debian GNU/Linux 6.0 \n \l

Ошибка такова

Показать

root@debian1:/# /etc/init.d/networking restart
Running /etc/init.d/networking restart is deprecated because it may not enable again some interfaces ... (warning).
Reconfiguring network interfaces...Internet Systems Consortium DHCP Client 4.1.1-P1
Copyright 2004-2010 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/eth0/08:00:27:a5:15:54
Sending on LPF/eth0/08:00:27:a5:15:54
Sending on Socket/fallback
DHCPRELEASE on eth0 to 192.168.0.1 port 67

после этого ssh отваливается. смотрим с консоли

ifconfig БЫЛ ДО ПЕРЕЗАПУСКА

Показать

root@debian1:/# ifconfig
eth0 Link encap:Ethernet HWaddr 08:00:27:a5:15:54
inet addr:192.168.0.103 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fea5:1554/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:208 errors:0 dropped:0 overruns:0 frame:0
TX packets:125 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:22787 (22.2 KiB) TX bytes:17674 (17.2 KiB)

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

ifconfig СТАЛ ПОСЛЕ ПЕРЕЗАПУСКА

Показать


lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)


nano /etc/network/interfaces

Показать

GNU nano 2.2.4 File: /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
iface eth0 inet dhcp

#allow-hotplug eth1
#iface eth1 inet manual

#allow-hotplug eth0:0
#iface eth0:0 inet dhcp

route ДО ПЕРЕЗАПУСКА

Показать

Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.0.0 * 255.255.255.0 U 0 0 0 eth0
default dir-300 0.0.0.0 UG 0 0 0 eth0

#148218

> после этого ssh отваливается
ну наверное сеть падает поэтому и разрывается соединение

[console]/etc/init.d/networking restart[/console]

[console]service networking restart[/console]

и еще написать скрипт и попробовать в нем поочередно
/etc/init.d/networking stop потом start
или
ifup eth0
ifdown eth0
Может поможет
Или вот http://welinux.ru/post/3029/#cmnt55398

#148251

попробуйте в /etc/network/interfaces

[console]allow-hotplug eth0
auto eth0
iface eth0 inet dhcp[/console]

#151816

короч, если я не чего не перепутал что параметр auto поднимает интерфейс от скрипта /etc/init.d/networking, а параметр allow-hotplug подымает от какой то другой лабуды...
тоесть, если мы хотим командой [console]/etc/init.d/networking restart [/console] eth0 подымался следует в [console]nano /etc/network/interfaces[/console] чиркнуть

text
# The primary network interface
auto eth0
iface eth0 inet dhcp

=======================
и усе будет прекрасно

#151817
Assembled написал:
а параметр allow-hotplug подымает от какой то другой лабуды...

Уважаемый, про лабуду - в раздел разговоры обо всём - welcome.
Тут так не надо.

Итого:
Интерфейс с опцией allow-hotplug срабатывает в момент подключения устройства с заданным именем, например:

text
allow-hotplug wlan0
iface wlan0 inet manual
 pre-up    _что_либо_выполнить_
 up        _что_либо_выполнить_
 post-down _что_либо_выполнить_
 down      _что_либо_выполнить_

Секции pre-up, up выполняются в момент когда ядро определяет интерфейс wlan0, post-down, down соответственно при выключении.

Войдите или зарегистрируйтесь, чтобы ответить.