LINUX.ORG.RU

Проблема настройки Bridge-utils + airbase-ng, требуется ваша помощь!

 , , , ,


0

1

ОС:Kali Linux

Решил я по пробовать поднять программную точку доступа на своей wifi карте, так как у меня идет проводное подключение (UTP-кабель).

Вообщем поднял я airbase-ng:
airmon-ng start wlan0          #Поднимаю его в режим монитора
airbase-ng -c 8 --essid "test" #Создаю сеть (ее видит прекрасно и пытается подключится)

Затем я хотел связать два интерфейса через Bridge-utils, что бы трафик с WiFiкарты уходил через комп и отправлялся на маршрутизатор. Естественно я нехочу вбивать на каждом устройстве статику (ip-адрес, ip-шлюза поумолчанию, dns-серверы, маску подсети и т.д) В оффициальной документации по настройке Bridge-utils прописано следующее:

Если вы хотите чтобы мост автоматически получал IP-адрес у ADSL-модема по DHCP (или в другой похожей ситуации), сделайте так:

ifconfig eth0 0.0.0.0
ifconfig eth1 0.0.0.0
brctl addbr mybridge
brctl addif mybridge eth0
brctl addif mybridge eth1 
dhclient mybridge
Исходя из этого руководства делаю аналогичные действия. Настраиваю bridge-utils:
brctl addbr test      #Создаю мост
brctl addif test eth0 #Добавляю интерфейс в мост(на нем у меня выход в интернет) 
brctl addif test at0  #"at0" - это вроде интерфейс который создает airbase-ng
Поднимаю интерфейсы:
ifconfig test up        #Поднимаю интерфейс моста
ifconfig at0 0.0.0.0 up #Поднимаю интерфейс airbase-ng
Поднимаю dhclient:
dhclient test
И козалось бы все отлично. Ошибок нигде нет и все хорошо, но проблем все равно проявилась, а именно дело в том, что телефон видит точку доступа, но не может к ней подключится, не может получить dhcp и отрубается.

Вот вывод с airbase-ng:
15:35:44  Created tap interface at0
15:35:44  Trying to set MTU on at0 to 1500
15:35:44  Trying to set MTU on wlan0mon to 1800
15:35:44  Access Point with BSSID 00:0E:2E:B1:EC:7B started.
15:40:33  Client 18:F0:E4:**:F9:** associated (unencrypted) to ESSID: "test"
15:40:33  Client 18:F0:E4:**:F9:** associated (unencrypted) to ESSID: "test"
15:40:33  Client 18:F0:E4:**:F9:** associated (unencrypted) to ESSID: "test"
15:40:33  Client 18:F0:E4:**:F9:** associated (unencrypted) to ESSID: "test"
15:40:33  Client 18:F0:E4:**:F9:** associated (unencrypted) to ESSID: "test"
15:40:33  Client 18:F0:E4:**:F9:** associated (unencrypted) to ESSID: "test"
Так же привожу вам вывод brctl show(bridge-utils):
bridge name	bridge id		STP enabled	interfaces
test		8000.000e2eb1ec7b	no		at0
							eth0
Вот вывод ifconfig для интерфейса at0,eth0,test:
at0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fe80::20e:2eff:feb1:ec7b  prefixlen 64  scopeid 0x20<link>
        ether 00:0e:2e:b1:ec:7b  txqueuelen 1000  (Ethernet)
        RX packets 7003  bytes 1062110 (1.0 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 3420  bytes 1076322 (1.0 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.0.101  netmask 255.255.255.0  broadcast 192.168.0.255
        inet6 fe80::836c:8ffa:1260:b1fc  prefixlen 64  scopeid 0x20<link>
        ether 18:31:bf:0a:ee:dd  txqueuelen 1000  (Ethernet)
        RX packets 172612  bytes 242885098 (231.6 MiB)
        RX errors 0  dropped 1  overruns 0  frame 0
        TX packets 105564  bytes 9002437 (8.5 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
test: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.0.115  netmask 255.255.255.0  broadcast 192.168.0.255
        inet6 fe80::20e:2eff:feb1:ec7b  prefixlen 64  scopeid 0x20<link>
        ether 00:0e:2e:b1:ec:7b  txqueuelen 1000  (Ethernet)
        RX packets 174234  bytes 239554616 (228.4 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 97868  bytes 7899758 (7.5 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Тут то вроде все работает. И имя интерфейса поднято, и оно правильно вписано в настройки ifconfig и bridge-utils, только вот понять не могу, почему уменя не получает dhcp телефон?
Очень прошу вашей помощи, сетевые инженеры и системные администраторы!

P.s: Есть такое предположение, что она запрашивает dhcp через utp-кабель у роутера, но так как у меня стоит на ethernet-порте статический адресс, он и не пропускает dhcp. Может ли в этом таится проблема??? Может ли быть проблема firewalld?

P.s.2: Задача пустить трафик, с выдачей dhcp на SoftAP.

Ответ на: комментарий от anonymous

Просто по расскинув мозгами нашел выход из этой ситуации. Установи пакет isc-dhcp-server.
Редактируем файл:

nano /etc/dhcp/dhcpd.conf

Настройки которые я в данный момент тестирую, в последсвие я их доработаю.
# dhcpd.conf
#
# Sample configuration file for ISC dhcpd
#

# option definitions common to all supported networks...
option domain-name "example.org";
option domain-name-servers 192.168.0.1;

default-lease-time 600;
max-lease-time 7200;

# The ddns-updates-style parameter controls whether or not the server will
# attempt to do a DNS update when a lease is confirmed. We default to the
# behavior of the version 2 packages ('none', since DHCP v2 didn't
# have support for DDNS.)
ddns-update-style none;

# If this DHCP server is the official DHCP server for the local
# network, the authoritative directive should be uncommented.
authoritative;

# Use this to send dhcp log messages to a different log file (you also
# have to hack syslog.conf to complete the redirection).
#log-facility local7;

# No service will be given on this subnet, but declaring it helps the 
# DHCP server to understand the network topology.

#subnet 10.152.187.0 netmask 255.255.255.0 {
#}

# This is a very basic subnet declaration.

#subnet 192.168.2.0 netmask 255.255.255.0 {
#  range 192.168.2.10 192.168.0.20;
#  option routers 192.168.2.1;
#  option subnet-mask 255.255.255.0;
#  option domain-search "google.com";
#  option domain-name-servers 192.168.2.1;
#}

# This declaration allows BOOTP clients to get dynamic addresses,
# which we don't really recommend.

#subnet 10.254.239.32 netmask 255.255.255.224 {
#  range dynamic-bootp 10.254.239.40 10.254.239.60;
#  option broadcast-address 10.254.239.31;
#  option routers rtr-239-32-1.example.org;
#}

# A slightly different configuration for an internal subnet.
subnet 192.168.2.0 netmask 255.255.255.0 {
  range 192.168.2.10 192.168.2.20;
  option domain-name-servers ns1.internal.example.org;
  option domain-name "internal.example.org";
  option routers 192.168.2.1;
  option broadcast-address 192.168.2.1;
  default-lease-time 600;
  max-lease-time 7200;
}

# Hosts which require special configuration options can be listed in
# host statements.   If no address is specified, the address will be
# allocated dynamically (if possible), but the host-specific information
# will still come from the host declaration.

#host passacaglia {
#  hardware ethernet 0:0:c0:5d:bd:95;
#  filename "vmunix.passacaglia";
#  server-name "toccata.example.com";
#}

# Fixed IP addresses can also be specified for hosts.   These addresses
# should not also be listed as being available for dynamic assignment.
# Hosts for which fixed IP addresses have been specified can boot using
# BOOTP or DHCP.   Hosts for which no fixed address is specified can only
# be booted with DHCP, unless there is an address range on the subnet
# to which a BOOTP client is connected which has the dynamic-bootp flag
# set.
#host fantasia {
#  hardware ethernet 08:00:07:26:c0:a5;
#  fixed-address fantasia.example.com;
#}

# You can declare a class of clients and then do address allocation
# based on that.   The example below shows a case where all clients
# in a certain class get addresses on the 10.17.224/24 subnet, and all
# other clients get addresses on the 10.0.29/24 subnet.

#class "foo" {
#  match if substring (option vendor-class-identifier, 0, 4) = "SUNW";
#}

#shared-network 224-29 {
#  subnet 10.17.224.0 netmask 255.255.255.0 {
#    option routers rtr-224.example.org;
#  }
#  subnet 10.0.29.0 netmask 255.255.255.0 {
#    option routers rtr-29.example.org;
#  }
#  pool {
#    allow members of "foo";
#    range 10.17.224.10 10.17.224.250;
#  }
#  pool {
#    deny members of "foo";
#    range 10.0.29.10 10.0.29.230;
#  }
#}

Теперь нужно выставить на какой интерфейс мы выдаем их.
nano /etc/default/isc-dhcp-server
Теперь выбираем интерфейс на который будем давать данные настройки.
# Defaults for isc-dhcp-server (sourced by /etc/init.d/isc-dhcp-server)

# Path to dhcpd's config file (default: /etc/dhcp/dhcpd.conf).
#DHCPDv4_CONF=/etc/dhcp/dhcpd.conf
#DHCPDv6_CONF=/etc/dhcp/dhcpd6.conf

# Path to dhcpd's PID file (default: /var/run/dhcpd.pid).
#DHCPDv4_PID=/var/run/dhcpd.pid
#DHCPDv6_PID=/var/run/dhcpd6.pid

# Additional options to start dhcpd with.
#	Don't use options -cf or -pf here; use DHCPD_CONF/ DHCPD_PID instead
#OPTIONS=""

# On what interfaces should the DHCP server (dhcpd) serve DHCP requests?
#	Separate multiple interfaces with spaces, e.g. "eth0 eth1".
INTERFACESv4="at0" #Выставляю тут свой интерфейс на котором поднята точка доступа.
INTERFACESv6=""

Теперь перезапускаем сервис isc-dhcp-server.
systemctl restart isc-dhcp-server.service


Теперь у меня все работает, сейчас буду эксперементировать с перенаправлением трафика с этого интфейса на интерфейс с которого получаю интернет.

Otsheln1k
() автор топика
Вы не можете добавлять комментарии в эту тему. Тема перемещена в архив.