oriolrius.cat

Des del 2000 compartiendo sobre…

Tag: ap

Ubuntu server as wifi AP and Mikrotik as a DHCP server

Reading time: 2 – 3 minutes

It’s important to have a very clear picture about the scenario that we’re going to configure in that case because it’s a little bit particular. This is an evolution of the previous post: Ubuntu server as wifi AP and Mikrotik as a DHCP server

schema

There is a server running Ubuntu 16.04 and offering wifi service as an AP. The wifi interface is in bridge mode with the ethernet port and send all traffic to the Mikrotik gateway where there is a DHCP server in charge to serve IP address to wifi clients.

Start by configuring the bridge in the Ubuntu server. File “/etc/network/interfaces”:

source /etc/network/interfaces.d/*

auto lo br0
iface lo inet loopback

#ethernet interface
allow-hotplug enp2s0
iface enp2s0 inet manual

#wifi interface
allow-hotplug wlp3s0
iface wlp3s0 inet manual

# Setup bridge
iface br0 inet static
    bridge_ports enp2s0 
    address 192.168.2.2
    netmask 255.255.255.0
    network 192.168.2.0

Pay attention on “bridge_ports” the wifi interface is not added on the list, this is because until the hostapd is running it doesn’t make sense to do that. You’ll see “bridge=br0” option on hostapd.conf which will fix that misbehavior.

Wifi AP configuration, “/etc/default/hostapd”:

DAEMON_CONF="/etc/hostapd/hostapd.conf"

and “/etc/hostapd/hostapd.conf”:

bridge=br0                # bridge interface
interface=wlp3s0          # wifi interface name
driver=nl80211
ssid=the_ssid_name        # name of your network
hw_mode=g
channel=1
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=3
wpa_passphrase=the_secret_key   # secret key to joing with the wifi network
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
logger_syslog=-1
logger_syslog_level=3
logger_stdout=-1
logger_stdout_level=1

DHCP server configuration on Mikrotik:

# setting the interface address, in my case ether4
/ip address
add address=192.168.2.1/24 interface=ether4 network=192.168.2.0

# setting up DHCP on interface 4 of the mikrotik device
/ip dhcp-server
add address-pool=dhcp-pool disabled=no interface=ether4 name=dhcp-pool

# network of the DHCP server
/ip dhcp-server network
add address=192.168.2.1.0/24 dns-server=8.8.8.8 domain=your_network.local gateway=192.168.2.1 netmask=24

# IP pool used by the DHCP server
/ip pool
add name=dhcp-pool ranges=192.168.2.65-192.168.2.70

New home server working as a wifi AP and DHCP server

Reading time: 2 – 3 minutes

At the beginning of August I’ve received a new home server, I decided to stop my old HP ML110 G5 and substitute that by a new silent and low power server also based on Intel technologies in this case it’s al i5 with 8G of RAM and 128GB of SSD for less than 300€ including custom costs I think it’s a very good investment.

fmp03-geekbuing

 

I installed Ubuntu 16.04 LTS server, I don’t tried de Win10 pre-installed. I happy to see a very new and powerful BIOS with tons of options. But in this blog entry I want to explain how to set-up the wifi card as a wifi AP. I didn’t have to do anything to configure the card. It worked by default.

Ralink corp. RT3090 Wireless 802.11n 1T/1R PCIe

The first thing is check if the wifi network is compatible with the AP mode.

iw list
...
Supported interface modes:
         * IBSS
         * managed
         * AP
         * AP/VLAN
         * monitor
         * mesh point
...

Next thing is install the “hostapd” which is going to take care to set-up the AP. The configuration file have to be something like that “/etc/hostapd/hostpad.conf

interface=wlan0   # change that with the wifi interface name
driver=nl80211
ssid=test         # your wifi network name
hw_mode=g
channel=1         # look up for a free channel
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=3
wpa_passphrase=1234567890   # passwor to join the wifi network
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP

Modify “/etc/default/hostapd” and put that:

DAEMON_CONF="/etc/hostapd/hostapd.conf"

Start the hostapd service:

sudo service hostapd start

Now the AP is running but a DHCP service giving IPs it’s need, I used “isc-dhcp-server”. First thing to configure is “/etc/default/isc-dhcp-server” with the wireless network name:

INTERFACES="wlan0"

Next file to be configured is “/etc/dhcp/dhcpd.conf”:

ddns-update-style none;
log-facility local7;

subnet 192.168.1.0 netmask 255.255.255.0 {
    range 192.168.1.128 192.168.1.253;
    option domain-name-servers 192.168.1.1;
    option routers 192.168.1.1;
}

Don’t forget to start the service:

sudo service isc-dhcp-server start

If it’s needed remember to create the proper iptables rules and enable “ip_forward” in /proc filesystem. I’m not going to describe that because in my case it’s not going to be useful.

This is not a specially interesting post entry but useful as a reference, when you have to use a fast and easy cookbook to setup a wifi AP.

La Fonera ja és aquí

Reading time: < 1 minute

Llàstima que estic destrossat que acabo d’arribar a casa i que ja no són hores d’estar a l’ordinador. Així doncs, de moment us haureu de conformar amb veure la foto de “La Fonera” que ja m’ha arribat, de fet, molt més ràpid del que l’esperava. Les males llengües m’havien dit que hi havia gent que feia mesos que l’esperava, és raro perquè aquest model jo diria que no fa tan que va sortir, però bé. Si ho diuen per algo deu ser.

fonera-1.jpg
fonera-2.jpg

hw per montar un firewall, router, ap, etc.

Reading time: 2 – 3 minutes

Gràcies al meu nou proveedor de hardware enquestat, mds 2000, m’he posat al dia del catàleg de productes d’AAEON una marca de material embedded molt interessant. El millor del tema és saber que pots comprar-ho a Barcelona mateix i a preu de PVD (Preu de venta distribuidor).

Doncs bé concretament hi ha un model que m’ha agradat molt per montar firewalls en linux (ve amb el Montavista Linux de serie) a casa dels clients, a més gràcies als dos slots mini-PCI tipus III que porta la placa puc posar-hi una o dues targetes wifi. Però el que potser m’ha agrada més són els 6 ports ethernet de que disposa el SBC.

Amb una RAM de 32 o 64Mb segons el model, un processador RISC d’Intel (XScale IXP420/422/425) amb 266 o 533MHz i amb 16Mb de flash. Per si tot això us sembla poc encara n’hi ha més 2 ports serie, 2 ports USB (1 USB 2.0 i 1 USB 1.1) i com no quatre sortides DIO, per controlar altres perifèrics amb protocols I2C, SPI o SMBus.

gene-1425.jpg

Al tractar-se d’un dispositiu embedded les seves mides són minúscules 156mm x 101.6mm i s’alimenta amb corrent continua amb un voltatge que pot anar dels 9 als 24v. O sigui, que tenim on triar. Ara només cal trobar-li una caixa que li vagi com un gua. Amb els ~275$ de cost, més els aproximadament ~10$ de la caixa i uns altres ~15$ de la font d’alimentació podem tenir un firewall, router o el que volguem per un preu molt raonable.

Si voleu aprofundir més sobre el producte:

Truquillo: Linksys WRT54G en mode client

Reading time: 2 – 2 minutes

La veritat és que no sé si algú ja hi havia pensat, jo crec que si però no ho he vist en cap manual i m’he trobat a molta gent que es queixava del mateix. Així que hi he pensat una solució que com dic imagino que més d’un ja hi deu haver pensat. Bé comencem explicant el problema:

El Linksys WRT54G si el fas treballar en mode client, jo només ho he provat de fer amb el firmware Alchemy, té problemes per enllaçar amb l’SSID que l’hi hem especificat i connecta al primer AP que troba tingui el nostre SSID o no. Així que a més d’un l’obliga a fer filigranes perquè enllaci a l’AP que l’interessa.

Doncs bé, el tema és tan senzill com aprofitar les funcionalitats de filtratge de MAC que porta el propi firmware. Per dir-li o bé que només pugui connectar a la MAC de l’AP que té l’SSID que ens interessa o bé, just el contrari. Podem indicar a quines MAC dels AP veins no volem que s’associï el nostre linksys.

Tonta la cosa,eh!? doncs a mi m’ha funcionat a la primera, a continuació us poso un screenshot on podeu veure on posar lo del filtratge de MACs.

apclient.png

En aquesta captura de pantalla es pot veure com li diem que només connecti a la MAC indicada. Que és la del AP al que vull connectar-me.