This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
настройка_сети_в_ubuntu [2011/02/10 15:01] val |
— (current) | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== Настройка сети в Ubuntu ====== | ||
| - | |||
| - | ===== Настройка "в ручную" ===== | ||
| - | <code> | ||
| - | # ifconfig -a | ||
| - | # ifconfig eth0 up | ||
| - | # ethtool eth0 | ||
| - | # ifconfig eth0 inet 172.16.1.X/24 | ||
| - | # route add default gw 172.16.1.254 | ||
| - | # route add -net 192.168.6.0 netmask 255.255.255.0 gw 172.16.1.6 | ||
| - | |||
| - | # ip addr show dev eth0 | ||
| - | # ip addr add 172.16.1.100+X/32 dev eth0 | ||
| - | # ip addr del 172.16.1.100+X/32 dev eth0 | ||
| - | </code> | ||
| - | |||
| - | ===== Файлы конфигурации ===== | ||
| - | |||
| - | ==== Файл /etc/udev/rules.d/70-persistent-net.rules ==== | ||
| - | <code> | ||
| - | ... | ||
| - | # PCI device 0x1022:0x2000 (pcnet32) | ||
| - | SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:18:7f:01", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0" | ||
| - | ... | ||
| - | </code> | ||
| - | |||
| - | ==== Файл /etc/network/interfaces ==== | ||
| - | <code> | ||
| - | auto lo | ||
| - | iface lo inet loopback | ||
| - | |||
| - | auto eth0 | ||
| - | iface eth0 inet static | ||
| - | address 172.16.1.X | ||
| - | netmask 255.255.255.0 | ||
| - | gateway 172.16.1.254 | ||
| - | |||
| - | # Alias example | ||
| - | # auto eth0:0 | ||
| - | # iface eth0:0 inet static | ||
| - | # address 10.5.Z.X | ||
| - | # netmask 255.255.255.0 | ||
| - | |||
| - | # Bridge example (need bridge-utils packet) | ||
| - | # auto br0 | ||
| - | # iface br0 inet static | ||
| - | # address 172.16.1.X | ||
| - | # netmask 255.255.255.0 | ||
| - | # gateway 172.16.1.254 | ||
| - | # bridge_ports eth0 | ||
| - | # bridge_stp off | ||
| - | # bridge_maxwait 5 | ||
| - | # post-up /usr/sbin/brctl setfd br0 0 | ||
| - | |||
| - | # 802.1q example (need vlan packet) | ||
| - | # auto vlan2 | ||
| - | # iface vlan2 inet static | ||
| - | # address 192.168.100+X.1 | ||
| - | # netmask 255.255.255.0 | ||
| - | # mtu 1500 | ||
| - | # vlan_raw_device eth0 | ||
| - | </code> | ||
| - | |||
| - | ==== Файл /etc/hostname ==== | ||
| - | <code> | ||
| - | gate.corpX.un | ||
| - | </code> | ||
| - | |||
| - | ==== Файл /etc/hosts ==== | ||
| - | <code> | ||
| - | 127.0.0.1 localhost | ||
| - | |||
| - | 172.16.1.X gate.corpX.un gate | ||
| - | 172.16.1.254 rep | ||
| - | </code> | ||
| - | |||
| - | ==== Файл /etc/resolv.conf ==== | ||
| - | <code> | ||
| - | search corpX.un | ||
| - | nameserver 172.16.1.254 | ||
| - | </code> | ||
| - | |||
| - | ===== Применение файлов настроек ===== | ||
| - | <code> | ||
| - | root@gate:~# hostname gate.corpX.un | ||
| - | |||
| - | root@gate:~# /etc/init.d/networking restart | ||
| - | </code> | ||
| - | |||
| - | ===== Команды для диагностики ===== | ||
| - | <code> | ||
| - | # mii-tool | ||
| - | |||
| - | # ethtool eth0 | ||
| - | |||
| - | # netstat -apn | ||
| - | |||
| - | # netstat -apn --tcp | ||
| - | </code> | ||