DESCRIPTION
/etc/network/interfaces contains network interface configuration
information for the
ifup(8)
and
ifdown(8)
commands.
This is where you configure how your system is connected to the network.
Lines starting with `#’ are ignored. Note that end-of-line comments are
NOT supported, comments must be on a line of their own.
A line may be extended across multiple lines by making the last character
a backslash.
The file consists of zero or more «iface», «mapping», «auto» and «allow-»
stanzas. Here is an example.
-
auto lo eth0 allow-hotplug eth1 iface lo inet loopback mapping eth0 script /usr/local/sbin/map-scheme map HOME eth0-home map WORK eth0-work iface eth0-home inet static address 192.168.1.1 netmask 255.255.255.0 up flush-mail iface eth0-work inet dhcp iface eth1 inet dhcp
Lines beginning with the word «auto» are used to identify the physical
interfaces to be brought up when
ifup
is run with the
-a
option. (This option is used by the system boot scripts.)
Physical interface names should follow the word «auto» on the same line.
There can be multiple «auto» stanzas.
ifup
brings the named interfaces up in the order listed.
Lines beginning with «allow-» are used to identify interfaces that should
be brought up automatically by various subsystems. This may be done using
a command such as «ifup —allow=hotplug eth0 eth1», which will only bring
up eth0 or eth1 if it is listed in an «allow-hotplug» line. Note that
«allow-auto» and «auto» are synonyms.
Stanzas beginning with the word «mapping» are used to determine how a
logical interface name is chosen for a physical interface that is to be
brought up. The first line of a mapping stanza consists of the word
«mapping» followed by a pattern in shell glob syntax. Each mapping stanza
must contain a
script
definition. The named script is run with the physical interface name as
its argument and with the contents of all following «map» lines
(without the leading «map») in the
stanza provided to it on its standard input. The script must print a
string on its standard output before exiting. See
/usr/share/doc/ifupdown/examples
for examples of what the script must print.
Mapping a name consists of searching the remaining mapping
patterns and running the script corresponding to the first match;
the script outputs the name to which the original is mapped.
ifup
is normally given a physical interface name as its first non-option argument.
ifup
also uses this name as the initial logical name for the interface unless
it is accompanied by a suffix of the form =LOGICAL, in which case
ifup chooses LOGICAL as the initial logical name for the interface.
It then maps this name, possibly more than once according to successive
mapping specifications, until no further mappings are possible. If the
resulting name is the name of some defined logical interface then
ifup
attempts to bring up the physical interface
as that logical interface. Otherwise
ifup
exits with an error.
Stanzas defining logical interfaces start with a line consisting of the
word «iface» followed by the name of the logical interface.
In simple configurations without mapping stanzas this name should simply
be the name of the physical interface to which it is to be applied.
(The default mapping script is, in effect, the
echo
command.)
The interface name is followed by the name of the address family that the
interface uses. This will be «inet» for TCP/IP networking, but there is
also some support for IPX networking («ipx»), and IPv6 networking («inet6»).
Following that is the name of the method used to configure the interface.
Additional options can be given on subsequent lines in the stanza.
Which options are available depends on the family and method,
as described below.
Additional options can be made available by other Debian packages.
For example, the wireless-tools package makes available a number of
options prefixed with «wireless-» which can be used to configure the
interface using
iwconfig(8).
(See
wireless(7)
for details.)
Options are usually indented for clarity (as in the example above)
but are not required to be.
IFACE OPTIONS
The following «command» options are available for every family and method.
Each of these options can be given multiple times in a single stanza,
in which case the commands are executed in the order in which they appear
in the stanza.
(You can ensure a command never fails by suffixing «|| true».)
- pre-up command
-
Run
command
before bringing the interface up.
If this command fails then
ifup
aborts,
refraining from marking the interface as configured,
prints an error message,
and exits with status 0.
This behavior may change in the future. - up command
- post-up command
-
Run
command
after bringing the interface up.
If this command fails then
ifup
aborts,
refraining from marking the interface as configured
(even though it has really been configured),
prints an error message,
and exits with status 0.
This behavior may change in the future. - down command
- pre-down command
-
Run
command
before taking the interface down.
If this command fails then
ifdown
aborts,
marks the interface as deconfigured
(even though it has not really been deconfigured),
and exits with status 0.
This behavior may change in the future. - post-down command
-
Run
command
after taking the interface down.
If this command fails then
ifdown
aborts,
marks the interface as deconfigured,
and exits with status 0.
This behavior may change in the future.
There exists for each of the above mentioned options a directory
/etc/network/if-<option>.d/
the scripts in which are run (with no arguments) using
run-parts(8)
after the option itself has been processed.
All of these commands have access to the following environment variables.
- IFACE
- physical name of the interface being processed
- LOGICAL
- logical name of the interface being processed
- ADDRFAM
- address family of the interface
- METHOD
-
method of the interface (e.g.,
static) - MODE
- start if run from ifup, stop if run from ifdown
- PHASE
-
as per MODE, but with finer granularity, distinguishing the
pre-up, post-up, pre-down and post-down phases. - VERBOSITY
- indicates whether —verbose was used; set to 1 if so, 0 if not.
- PATH
-
the command search path:
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
Additionally, all options given in an interface definition stanza are
exported to the environment in upper case with «IF_» prepended and with
hyphens converted to underscores and non-alphanumeric characters discarded.
INET ADDRESS FAMILY
This section documents the methods available in the
inet address family.
The loopback Method
This method may be used to define the IPv4 loopback interface.
Options
-
- (No options)
The static Method
This method may be used to define ethernet interfaces with statically allocated IPv4 addresses.
Options
-
- address address
- Address (dotted quad) required
- netmask netmask
- Netmask (dotted quad) required
- broadcast broadcast_address
- Broadcast address (dotted quad)
- network network_address
- Network address (dotted quad) required for 2.0.x kernels
- metric metric
- Routing metric for default gateway (integer)
- gateway address
- Default gateway (dotted quad)
- pointopoint address
- Address of other end point (dotted quad). Note the spelling of «point-to».
- media type
- Medium type, driver dependent
- hwaddress class address
- Hardware Address. class is one of ether, ax25, ARCnet or netrom. address is dependent on the above choice.
- mtu size
- MTU size
The manual Method
This method may be used to define interfaces for which no configuration is done by default. Such interfaces can be configured manually by means of up and down commands or /etc/network/if-*.d scripts.
Options
-
- (No options)
The dhcp Method
This method may be used to obtain an address via DHCP with any of the tools: dhclient, pump, udhcpc, dhcpcd. (They have been listed in their order of precedence.) If you have a complicated DHCP setup you should note that some of these clients use their own configuration files and do not obtain their configuration information via ifup.
Options
-
- hostname hostname
- Hostname to be requested (pump, dhcpcd, udhcpc)
- leasehours leasehours
- Preferred lease time in hours (pump)
- leasetime leasetime
- Preferred lease time in seconds (dhcpcd)
- vendor vendor
- Vendor class identifier (dhcpcd)
- client client
- Client identifier (dhcpcd, udhcpc)
- hwaddress class address
- Hardware Address. class is one of ether, ax25, ARCnet or netrom. address is dependent on this choice.
The bootp Method
This method may be used to obtain an address via bootp.
Options
-
- bootfile file
- Tell the server to use file as the bootfile.
- server address
- Use the IP address address to communicate with the server.
- hwaddr addr
- Use addr as the hardware address instead of whatever it really is.
The ppp Method
This method uses pon/poff to configure a PPP interface. See those commands for details.
Options
-
- provider name
- Use name as the provider (from /etc/ppp/peers).
The wvdial Method
This method uses wvdial to configure a PPP interface. See that command for more details.
Options
-
- provider name
- Use name as the provider (from /etc/ppp/peers).
IPX ADDRESS FAMILY
This section documents the methods available in the
ipx address family.
The static Method
This method may be used to setup an IPX interface. It requires the ipx_interface command.
Options
-
- frame type
- type of ethernet frames to use (e.g. 802.2)
- netnum id
- Network number
The dynamic Method
This method may be used to setup an IPX interface dynamically.
Options
-
- frame type
- type of ethernet frames to use (e.g. 802.2)
INET6 ADDRESS FAMILY
This section documents the methods available in the
inet6 address family.
The loopback Method
This method may be used to define the IPv6 loopback interface.
Options
-
- (No options)
The static Method
This method may be used to define interfaces with statically assigned IPv6 addresses.
Options
-
- address address
- Address (colon delimited) required
- netmask mask
- Netmask (number of bits, eg 64) required
- gateway address
- Default gateway (colon delimited)
- media type
- Medium type, driver dependent
- hwaddress class address
- Hardware Address. class is one of ether, ax25, ARCnet or netrom. address is dependent on this choice.
- mtu size
- MTU size
The manual Method
This method may be used to define interfaces for which no configuration is done by default. Such interfaces can be configured manually by means of up and down commands or /etc/network/if-*.d scripts.
Options
-
- (No options)
The v4tunnel Method
This method may be used to setup an IPv6-over-IPv4 tunnel. It requires the ip command from the iproute package.
Options
-
- address address
- Address (colon delimited)
- netmask mask
- Netmask (number of bits, eg 64)
- endpoint address
- Address of other tunnel endpoint (IPv4 dotted quad) required
- local address
- Address of the local endpoint (IPv4 dotted quad)
- gateway address
- Default gateway (colon delimited)
- ttl time
- TTL setting
KNOWN BUGS/LIMITATIONS
The
ifup
and
ifdown
programs work with so-called «physical» interface names.
These names are assigned to hardware by the kernel.
Unfortunately it can happen that the kernel assigns different
physical interface names to the same hardware at different
times; for example, what was called «eth0» last time you booted
is now called «eth1» and vice versa.
This creates a problem if you want to configure the interfaces
appropriately.
A way to deal with this problem is to use mapping scripts that
choose logical interface names according to the properties of
the interface hardware.
See the
get-mac-address.sh
script in the examples directory for an example of such a mapping
script. See also Debian bug #101728.
It is not currently possible to divide up
/etc/network/interfaces
into multiple files. A feature that would make this possible is
some sort of inclusion directive. No such feature exists in the
current ifupdown program. For more information see Debian
bug #159884.
Первый шаг — настройка сети в virtualbox. Виртуальная машина должна быть выключена. Идем в «Настройки -> Сеть», выбираем неиспользуемый адаптер, включаем его и выбираем тип подключения — «виртуальный адаптер хоста»:
Далее загружаем виртуальную машину и проверяем сеть.
В windows сеть можно проверить командой «ipconfig»:
На ОС Linux из терминала сеть можно проверить так:
ifconfig
В ответ вы должны увидеть работающие сетевые интерфейсы:
По ip можно догадаться, какой интерфейс отвечает за организацию локальной сети между компьютером и виртуальной машиной, по умолчанию (если вы сами не настраивали ip в virtualbox) такой ip должен выглядеть так: 192.168.56.* (вместо * обычно бывает 101 или 102 и т. д.).
Этот ip и нужно использовать для доступа к виртуальной машине.
По умолчанию ip выдается dhcp сервером virtualbox. Для удобства можно задать статический ip адрес в самой виртуальной машине. Например в windows это делается редактированием свойств сети. В интерфейсе linux все аналогично, а вот как это сделать в терминале, без графической оболочки, будет показано ниже, на примере добавления нового сетевого интерфейса в ubuntu server.
В linux бывает, что интерфейс локальной сети между компьютером и виртуальной машиной по умолчанию не задействован, и как следствие, отсутствует локальная сеть. В этом случае необходимо поднять интерфейс локальной сети между компьютером и виртуальной машиной вручную. Далее будет описан процесс задействования сетевого интерфейса в ubuntu server.
Сначала нужно найти название сетевого интерфейса, который нам нужен. В терминале набираем:
ip a
В результате вы получите список всех сетевых интерфейсов.
Находим нужный интерфейс, он чаще всего последний. Возможно скорее всего это либо eth1 (для ubuntu server 14.04), либо enp0s8 (для ubuntu server 16.04), все зависит от количества подключенных сетевых адаптеров к виртуальной машине.
Далее редактируем файл /etc/network/interfaces
nano /etc/network/interfaces
Файл /etc/network/interfaces для ubuntu server 14.04:
# The loopback network interface auto lo iface lo inet loopback # The primary network interface auto eth0 iface eth0 inet dhcp
В конец файла добавляем строку (для ip, задаваемого динамически):
auto eth1 iface eth1 inet dhcp
Для статического ip:
auto eth1 iface eth1 inet static address 192.168.56.101 netmask 255.255.255.0
Вместо eth1 может быть другое название интерфейса, в зависимости от вашей конфигурации.
После этого нужно перезагрузить виртуальную машину и снова набрать команду:
ifconfig
В списке должен появиться интерфейс eth1, или тот, который прописали вы.
Настройка файла /etc/network/interfaces для ubuntu server 16.04:
# The loopback network interface auto lo iface lo inet loopback # The primary network interface auto enp0s3 iface enp0s3 inet dhcp
Здесь интерфейс называется enp0s3 вместо eth0. Согласно данным, полученным командой «ip a», в моем случае в конец файла нужно добавить:
auto enp0s8 iface enp0s8 inet dhcp
После внесения изменений так же необходимо перезапустить виртуальную машину, либо можно перезапустить только службу networking:
sudo service networking restart
На ubuntu server 14.04 у меня она не всегда перезапускается, просто продолжает работать, с ubuntu 16.04 в этом плане все впорядке, но для полной уверенности я считаю что лучше все таки перезапустить виртуальную машину.
После перезапуска машины и набора в терминале команды ifconfig в полученном списке сетевых интерфейсов должен появится интерфейс enp0s8.
Что делать, если сетевой интерфейс так и не заработал?
Тут два основных варианта: либо вы указали неправильный интерфейс в файле /etc/network/interfaces — в таком случае еще раз внимательно посмотрите список всех доступных сетевых интерфейсов командой «ip a» и выберите нужный. Либо виртуальная ОС вообще не видит сетевой адаптер. В этом случае скорее всего в ОС нет подходящих драйверов для этого адаптера. Эту проблему можно решить сменой типа адаптера, например на «паравиртуальная сеть (virtio-net)»:
Можете поэксперементировать с типом адаптера для достижения нужного результата.
После успешной настройки локальной сети между компьютером и виртуальной машиной можно к ней подключиться, например по ssh. Для этого набираем ip адрес, про который я писал вначале статьи, в ssh клиенте и радуемся успешному подключению)
Настройка сетевых интерфейсов
Содержание
Установка
Для Debian 9 (stretch) нужно ставить пакет net-tools:
apt install net-tools
или команду ip
Скорость
ethtool eth0
Отключение IPv6
Для всех:
- /etc/sysctl.conf
-
net.ipv6.conf.all.disable_ipv6 = 1 net.ipv6.conf.default.disable_ipv6 = 1
Для отдельных интерфейсов:
- /etc/sysctl.conf
-
net.ipv6.conf.lo.disable_ipv6 = 1 net.ipv6.conf.eth0.disable_ipv6 = 1
После изменений нужно перечитать настройки сетевых интерфейсов и выполнить:
sysctl -p
Также нужно перезапустить нужные службы или перезагрузить систему.
Настройка на статический IP-адрес
Файл /etc/network/interfaces
Пример
- /etc/network/interfaces
-
auto eth0 iface eth0 inet static address 10.0.0.100 netmask 255.255.255.0 gateway 10.0.0.1 dns-search example.com dns-nameservers 192.168.3.45 192.168.8.10
Псевдоним (alias)
Файл /etc/network/interfaces
Пример:
auto eth0:1 iface eth0:1 inet static address 10.56.2.1 netmask 255.255.255.0 network 10.56.2.0 broadcast 10.56.2.255
Добавление псевдонима «на ходу»
ifconfig eth0:1 10.56.2.1 netmask 255.255.255.255 up
Удаление, изменение имени сетевого интерфейса
При замене, добавлении сетевой карты или установке диска с системой в другой компьютер возникает необходимость изменения параметров сетевой карты.
Нужно внести изменения в файл /etc/udev/rules.d/70-persistent-net.rules
Описание работы с udev.
DHCP
Динамический адрес.
-
Команда для получения адреса
dhclient интерфейс -v-
Пример для интерфейса
eth0dhclient eth0 -v
-
Маршрутизация
Маршрут по умолчанию
route add default gw 10.0.0.1
Добавление маршрута сети
Пример:
route add -net 10.56.2.0 netmask 255.255.255.0 gw 10.0.0.1
Добавление маршрута к сети 10.56.2.0 по маске 255.255.255.0 через шлюз 10.0.0.1
Пример скрипта который настраивает маршрутизацию
Пример постоянного маршрута
- /etc/network/interfaces
-
up route add -net 10.56.2.0 netmask 255.255.255.0 gw 10.0.0.1 down route del -net 10.56.2.0 netmask 255.255.255.0 gw 10.0.0.1
IP Forwarding
По умолчанию система не выполняет маршрутизацию проходящих пакетов.
Чтобы ее включить (превратить сервер в маршрутизатор) необходимо установить переменную ядра:
sysctl net.ipv4.ip_forward=1
Чтобы это значение сохранилось после перезагрузки нужно добавить в файл /etc/sysctl.conf:
- /etc/sysctl.conf
-
net.ipv4.ip_forward=1
После изменений нужно перечитать настройки сетевых интерфейсов и выполнить:
sysctl -p
Перечитать настройки
Перезапустить настройки
service networking restart
Перезагрузить настройки
Эту команду удобно использовать для перезагрузки Туннеля IPIP
service networking reload
Текущий шлюз по умолчанию (default gateway)
Список открытых соединений
Все:
netstat -an | grep LISTEN
В состоянии TIME_WAIT:
netstat -an | grep TIME_WAIT
Intel Network Device and Driver Information Utility for Linux
Ссылки
Пример конфигурационного файла /etc/network/interfaces для Debian/Ubuntu систем. А так же создание алиаса интерфейса и указание DNS сервера в самом файле, без использования resolv.conf
Сетевая петля:
auto lo iface lo inet loopback
Первый интерфейс:
allow-hotplug eth0 #автоматически выполнять перезапуск интерфейса при его падении auto eth0 #поднимать интерфейс автоматически при старте системы iface eth0 inet dhcp #получить адрес по DHCP
Назначение алиаса сетевой карте:
auto eth0:1 iface eth0:1 inet dhcp
Второй интерфейс:
allow-hotplug eth1 #автоматически выполнять перезапуск интерфейса при его падении
auto eth1 #поднимать интерфейс автоматически при старте системы
#iface eth1 inet dhcp #получить адрес по DHCP
iface eth1 inet static #статический адрес
address 192.168.0.1 #IP адрес
netmask 255.255.255.0 #маска
gateway 192.168.0.254 #шлюз
Начиная с Ubuntu 12.04, правильная запись DNS сервера (ну вот нахера они так сделали??? //_-)):
dns-nameservers 192.168.0.254 8.8.8.8
Для остальных дистрибутивов, не базирующихся на Ubuntu, пока не актуально, т.к. они используют канонический /etc/resolv.conf
Для сохранения подмененного MAC адреса при перезагрузке системы:
pre-up ifconfig eth0 hw ether xx:xx:xx:xx:xx:xx
Полный листинг файла /etc/network/interfaces:
auto lo
iface lo inet loopback
allow-hotplug eth0
auto eth0
iface eth0 inet dhcp
auto eth0:1
iface eth0:1 inet dhcp
allow-hotplug eth1
auto eth1
iface eth1 inet static
address 192.168.0.1
netmask 255.255.255.0
gateway 192.168.0.254
dns-nameservers 192.168.0.254 8.8.8.8
pre-up ifconfig eth0 hw ether xx:xx:xx:xx:xx:xx
Как выяснилось опытным путем, система критична в порядку поднятия интерфейсов, поэтому надо поднимать в таком порядке: lo, eth0, eth0:1 и eth1.
Время на прочтение4 мин
Количество просмотров90K
Весна, снова потянуло на эксперименты. Ну, в моем понимании этого слова. Решил поставить себе в Windows 7 виртуальную машину, а в эту машину — Ubuntu 16.04 Server (под которой работает хостинг для моих сайтов). И не то чтобы меня как-то OpenServer не устраивает — он как раз весьма неплох в качестве домашнего WAMP-а, но всё же иногда хочется иметь под рукой локально и LAMP, ну просто потому что. В качестве виртуальной машины [ожидаемо] выбрал VirtualBox.
В целом, установка Ubuntu 16.04 Server на VirtualBox каких-то особых вопросов не вызвала, но вот настройка сети в Ubuntu так, чтобы ее было видно из Windows, поставила меня в тупик. Ибо опыта в этом деле — 0, а мануалы по теме хотя и гуглятся во множестве, но в каждом из них тема почему-то раскрыта лишь частично, и требует уже определенного уровня знания Linux и принципов работы сетевых интерфейсов.
В конечном итоге я этот вопрос решил и теперь делюсь с теми, кому оно тоже актуально. Приступим.
1. Скачиваем VirtualBox для Windows www.virtualbox.org/wiki/Downloads
2. Скачиваем Ubuntu Server 16.04 www.ubuntu.com/download/server
3. Устанавливаем VirtualBox в систему (ставится легко, раскрывать этот вопрос здесь не буду, в крайнем случае — в сети есть много шпаргалок по теме).
4. Ставим Ubuntu Server 16.04 в VirtualBox. Здесь тоже всё не сложнее (а то и проще), чем установка винды, например, и много всяких хороших руководств с картинками (они, в общем, и не требуются — всё интуитивно понятно). Но есть пара нюансов:
4.1 При установке сети выберите автоматическую настройку.
4.2 При установке пакетов сразу поставьте галки на сервер OpenSSH и LAMP (остальное по желанию) — так проще.
5. Я полагаю, что все у вас прошло нормально, Ubuntu загрузилась, и интернет в ней наличествует ( проверить можно командой ping yandex.ru например). Однако, остается вопрос, как, например, законнектиться с Ubuntu из Windows скажем, через SSH. Или просто даже открыть в браузере сайт, работающий на убунтовском Apache.
6. Итак, остановим нашу Ubuntu, закроем окно с терминалом, и уже в главном окне VirtualBox идем в Файл → Настройки → Сеть → Виртуальные сети хоста — справа три маленькие иконки — жмем на нижнюю с изображением отвертки.
7. Видим IP-адрес: 192.168.56.1 — это адрес, по которому Windows обращается к VirtualBox.
8. Рядом вкладка «DHCP сервер» в нашем случае она пуста (чекбокс не выбран). И пусть таковой и остается.
9. Далее идем в настройки гостевой системы (в нашем случае — Ubuntu 16.04.2 Server), щелкаем правой кнопкой на вкладке с системой и выбираем самый верхний пункт «Настроить…».
10. Здесь снова идем в «Сеть» (у нас получается два одноименных пункта «Сеть», но в первом случае мы настраивали сеть Windows и VirtualBox, а теперь мы настраиваем сеть гостевой системы — Ubuntu в связке с остальным). Здесь мы видим, что для первого адаптера отмечена NAT. Не меняем.
11. Открываем вкладку «Адаптер 2», ставим галку на «Включить сетевой адаптер» и в списке выбираем тип подключения: «Виртуальный адаптер хоста». Жмем ОК. Это действие добавит нам в Ubuntu сетевой адаптер, через который мы и прорубим окно во внешний мир, и в которое можно будет посмотреть на Ubuntu из Windows, через браузер или SSH-клиент, например.
12. Далее идем в окно терминала Ubuntu, логинимся (если еще не), и сразу ставим mc
sudo apt-get install mc
Чем значительно облегчаем себе дальнейшую жизнь (здесь вспоминается высказывание древнего философа: — Это как же нужно было не любить людей, чтобы содать vi )
13. Смотрим какие сетевые интерфейсы нам доступны:
ifconfig -a
Нужно это для того, чтобы понять, какое имя в Ubuntu носит тот самый «Виртуальный адаптер хоста», который мы создали в шаге №11
На скрине вы видите уже настроенные интерфейсы, но у вас будет примерно то же самое. Нас в данной ситуации исключительно интересует какое имя носит сетевой интерфейс, через который мы и будем осуществлять доступ из винды в убунту.
Здесь мы видим, что есть три интерфейса: lo — локальная петля, enp0s3 — это «Адаптер 1» который у нас настроен как NAT (через него идет интернет-трафик в Ubuntu) и, наконец, enp0s8 — это и есть вышеупомянутый «Адаптер 2» («Виртуальный адаптер хоста»). Теперь осталось его настроить.
14. Запускаем mc от имени суперпользователя:
sudo mc
15. И открываем для правки файл
/etc/network/interfaces
(переводим на него курсор и жмем F4), либо просто командой
mcedit /etc/network/interfaces
Но лично я предпочитаю через mc — меньше буковок набирать приходится 
16. И добавляем туда в конец текста такие строки:
auto enp0s8
iface enp0s8 inet static
address 192.168.56.107
netmask 255.255.255.0
Получается что-то вроде как показано на скрине:
Если двумя словами, то мы тем самым нашему «Адаптеру 2» дали статический IP-адрес: 192.168.56.107 (можете поменять его на 192.168.56.101 например, или 192.168.56.110, без разницы). И теперь через этот адрес, Ubuntu будет видна из Windows.
17. Сохраняем изменения — F2 и выходим из редактора — F10.
18. Далее перезапускаем интерфейсы, например так:
sudo service networking restart
или можете просто перезагрузить Ubuntu Server.
19. Теперь, если звезды на небе расположены правильно, то открыв браузер, и набрав в адресной строке:
http://192.168.56.107
вы увидите приветственную страницу установленного в составе LAMP (см.п. 4.2 выше) Apache2.
Либо можете законнектиться по SSH через 22 порт по этому же IP-адресу: 192.168.56.107
