How To Create a Zone in Solaris 11

Post original em Richard’s Tech Blog

This explains how to setup development zones in Solaris 11- this is described as part of a larger HOWTO (Refer to: http://jasonpenton.wordpress.com/2011/07/14/solaris-11-zone-with-vnic-and-dualstack-ipv4-and-ipv6/) but is repeated here as a standalone guide.

Start from the global zone.

To create the virtual NICs:

Create 1 vnic for each zone you want to run:
dladm create-vnic -l e1000g0 vnic1

To see the VNIC you have just added:
dladm show-vnic

Continuar lendo

Solaris 11 zone with vnic and dualstack IPv4 and IPv6

Post original em Jason’s Blog

So today I managed to get a Solaris 11 zone up and running dualstacked for both IPv4 and IPv6 addresses. Here’s how:

I started with a clean installation of Solaris 11. From the start I disabled the crappy NWAM (network automagic) – ala do sh!t behind your back and take all control away from you. Also, you cannot assign a static ipv6 address to a machine running nwam.

svcadm disable svc:/network/physical:nwam
svcadm enable svc:/network/physical:default

Continuar lendo

Postfix – Relay agent

Autor: Julio Cesar Xavier Luz <agostode1974 at gmail.com> Data: 19/03/2013 – Post Original em Viva O Linux

Introdução

O Postfix é um servidor de e-mails muito flexível, que foi lançado para tentar substituir o Sendmail, tradicionalmente, o servidor de e-mails mais conhecido, não apenas no GNU/Linux, mas nos sistemas Unix em geral.

Ultimamente, a queda da popularização do Sendmail vem ocorrendo por causa de dois motivos:

  • Primeiro: o brutal número de recursos que tornam a configuração muito complexa e trabalhosa.
  • E segundo: a questão da segurança, ou seja, o histórico de vulnerabilidades muito grande.

Continuar lendo

Particionamento GPT – Conceitos básicos

Autor: KYETOY <fernabyte at gmail.com> Data: 19/03/2013 Post Original em Viva o Linux

Particionamento GPT

A especificação UEFI propõe um novo modelo de tabela de partições em substituição à antiga tabela de partições DOS, mantida no MBR.

A nova tabela é chamada de GPT – GUID Partition Table – e suas principais vantagens, são:

  • Redundância e checagem de integridade através de CRC32.
  • Limite de 128 partições primárias. Não há partições lógicas.
  • Comporta unidades de disco maiores que 2 TiB.
  • Não utiliza código de arranque em estágio 1, que é ineficiente.

Continuar lendo

Bonding + VLAN + Heartbeat ou UCARP (Debian/RedHat like)

Post original em Do bit Ao Byte

Escrevi sobre cada um desses recursos independentemente em outros posts. Se estiver procurando por algum deles especificamente, basta digitar ali na caixa de pesquisa à direita.
Este post escrevi especificamente por que a configuração desse tipo pode causar algum nó na cabeça, além de ser possível uma variação dela (cuja variação não sei se funciona).

Apresentação
Bonding é a agregação de link, somando a banda das interfaces ou deixando uma como ativa e uma como backup. Para um bom entendimento desse recurso, leiaesse post onde detalho seus principais modos e descrevo as condições de rede para cada tipo.

Para um bom entendimento da configuração de VLAN, recomendo esse outro post. Repare que os links que estou colocando mostram a configuração desses recursos em Debian de forma separada. Aqui serão exibidas as configurações completas, que deverão servir para praticamente todos os Linux.

Continuar lendo

8 Linux Commands: To Find Out Wireless Network Speed, Signal Strength And Other Information

Post original at Nixcraft at JUNE 6, 2012
Linux operating systems comes with various set of tools allowing you to manipulate the Wireless Extensions and monitor wireless networks. This is a list of tools used for wireless network monitoring tools that can be used from your laptop or desktop system to find out network speed, bit rate, signal quality/strength, and much more.

#1: Find out your wireless card chipset information

Type the following command to list installed wireless card, enter:
lspci
lspci | grep -i wireless
lspci | egrep -i --color 'wifi|wlan|wireless'

Sample outputs:

0c:00.0 Network controller: Intel Corporation Ultimate N WiFi Link 5300

Please note down the 0c:00.0.

Continuar lendo

Making a WiFi Hotspot / Access Point using Linux & wifi lan card/USB adapter

Post Original at Vivek’s Blokg – March 31, 2011

If you have a wifi LAN card / USB adapter, then you can use it as an access point so that other machines can connect to the internet via your machine using Wifi. The process is fairly simple, but requires you to have a compatible set of drivers which allow a wifi lan card to come into “Master” mode.

It didn’t work well for

  • Linksys WUSB54GC v3 USB adapter. Till Ubuntu 10.04, there were no good drivers for use with hostapd (supporting mac80211 / nl80211). In Ubuntu 10.10, though the drivers were working, but the connection was highly unstable – in fact unusable. The drivers that I tried were rt2800usb (which allowed the adapter to come into Master mode), and rt2870sta which didn’t allow the adapter to come into “Master” mode. It always remained “Auto” or “Managed” (checked via iwconfig). Need to test in 11.04 when it arrives.

What worked pretty well

  • 02:00.0 Ethernet controller: Atheros Communications Inc. AR5001 Wireless Network Adapter (rev 01), using ath5k drivers. hostapd didn’t complain at all and all was smooth. This was in Ubuntu 10.04.

Concept

  1. There’s an application called hostapd which allows converting a wifi adapter into an access point and provide privileges such as WPA authentication and ssid name definition etc. I used it and it worked well.
  2. When a client connects to the access point, apart from authentication it’ll require IP addresses to be assigned. For that a DHCP server is used.
  3. You need to have 2 interfaces, one which accesses the net (e.g. eth0), and other which provides the access point services (e.g. wlan0).
  4. You start the wlan interface, assign it an IP address, start the dhcp server, setup firewall/nat and start hostapd. That’s all to it. Your devices would be able to use the wifi adapter as the access point.

Procedure

apt-get install dhcp3-server hostapd

Modify /etc/hostapd/hostapd.conf and put the following

interface=wlan0
driver=nl80211
ssid=MyAP
hw_mode=g
channel=11
wpa=1
wpa_passphrase=MyPasswordHere
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP CCMP
wpa_ptk_rekey=600

The dhcpd.conf section in /etc/dhcp3/dhcpd.conf would have something like the following

subnet 10.10.0.0 netmask 255.255.255.0 {
        range 10.10.0.25 10.10.0.50;
        option domain-name-servers 8.8.4.4, 208.67.222.222;
        option routers 10.10.0.1;
}

Modify /etc/default/dhcp3-server

INTERFACES="wlan0"

Check what name your adapter got via iwconfig. You can change the name also and make it persistent via /etc/udev/rules.d/70-persistent-net.rules so that it always gets a single type of name. In our example we’re assuming wlan0, but it could be changed. Make necessary changes in your configuration too.

Configure the new interface

ifconfig wlan0 10.10.0.1

The above could also be done in a better way via the /etc/network/interfaces file, but didn’t try it out. In any case if you shutdown hostapd, the network interface (wlan0) loses its address, so need to put a script which assigns it again before hostapd is started. An example could be

iface wlan0 inet static
 address 10.10.0.1
 netmask 255.255.255.0

Restart the dhcp3-server. It should now be ready to serve addresses and is also bound to the network interface too.

Allow ip masquerading

echo "1" > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

Now start hostapd and see the messages that it shows

hostapd -dd /etc/hostapd/hostapd.conf

Wait for a few seconds, it should show some probes being done by other wifi devices. If it shows, then probably you’re in good luck.

Now try to connect via your device to this access point. It should work.

To make this work on boot, can put the relevant config in /etc/default/hostapd

RUN_DAEMON="yes"
DAEMON_CONF="/etc/hostapd/hostapd.conf"
DAEMON_OPTS="-dd"

and also put the firewall rules in /etc/rc.local (make sure its executable).

Remember – if you shutdown your hostapd, the network card would lose its address. So you have to assign that again before starting hostapd. The usual practice would be

  • Stop hostapd
  • Stop dhcp server
  • Restart network (or rather ifup wlan0 / ifconfig wlan0 10.10.0.1 would do)
  • Restart dhcp server
  • Start hostapd

Miscellaneous

  1. You can check the wifi interfaces via
    iwconfig
  2. To set a wifi adapter into master mode, try the following. If it doesn’t work and shows an error that it’s not possible or something, fret not – use hostapd as that’ll do that in any case.
    iwconfig wlan0 mode Master
  3. Network Manager could create issues, though in my test environment – instead of using an ethernet interface, I used two wlan interfaces, one being controlled by Network Manager for internet access, and other for making it an access point.
  4. modprobe -r ath5k / modprobe -r rt2800usb etc. is to be used for unloading the modules.
  5. If you wish to proceed without using authentication so that you can test it easy, then put the following in /etc/hostapd/hostapd.conf
    interface=wlan0
    driver=nl80211
    ssid=MyAP
    hw_mode=g
    channel=11

Debian / Ubuntu Linux: Setup Wireless Access Point (WAP) with Hostapd

Original Posto at Nixcract  on AUGUST 25, 2012

I’ve got a spare USB Wireless Adapters (WIFI adapter/dongle) and my ISP router does not support wireless option. How do I turn my home nas server into a wireless access point (WAP) that allows wireless devices to connect to a wired network using Wi-Fi under Debian or Ubuntu Linux operating systems without purchasing additional WPA box?

You need to use hostapd server as access point and authentication servers. It implements IEEE 802.11 access point management, IEEE 802.1X/WPA/WPA2/EAP Authenticators, RADIUS client, EAP server, and RADIUS authentication server. The current version supports Linux:

  1. Host AP
  2. madwifi
  3. mac80211-based

You can use USB or PCI / Mini-PCI based network card. Please note that not all network cards or drivers support AP mode.

Sample setup

  1. wlan0 – Wireless PCI or USB device connected to Linux with a/b/g and WPA2 support in AP mode.
  2. eth0 – Wired ethernet port connected to the upstream router / switch for the Internet access.

Sample network diagram:

 

Internet
  \
    \\
    |\      +------------+ RJ-11/ADSL-line
      \-----+ ISP Router |                     +--------+
            +------------+ RJ-45 (eth0) -------+ Switch |
             192.168.1.2                       +--------+
             with DNS/DHCPD                    |
             server +                          +----> Laptop wireless
             Firewall                          |
                                               +----> Home nas server with wifi card wlan0 and eth0 wired
                                               |      with 192.168.1.11 static IP
                                               +----> Desktop wired
                                               |
                                               +----> HP Printer wired
                                               |
                                               +----> Andriod tablet wireless
                                               |
                                               +----> Andriod mobile phone wireless and so on

Step #1: Install hostapd

Type the following command:
# apt-get install hostapd
Sample outputs:

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  hostapd
0 upgraded, 1 newly installed, 0 to remove and 15 not upgraded.
Need to get 346 kB of archives.
After this operation, 877 kB of additional disk space will be used.
Get:1 http://debian.osuosl.org/debian/ squeeze/main hostapd amd64 1:0.6.10-2 [346 kB]
Fetched 346 kB in 2s (151 kB/s)
Selecting previously deselected package hostapd.
(Reading database ... 267669 files and directories currently installed.)
Unpacking hostapd (from .../hostapd_1%3a0.6.10-2_amd64.deb) ...
Processing triggers for man-db ...
Setting up hostapd (1:0.6.10-2) ...

 

Step #2: Configure hostapd

Edit /etc/default/hostapd, enter:
# vi /etc/default/hostapd
Uncomment and set DAEMON_CONF to the absolute path of a hostapd configuration file and hostapd will be started during system boot:

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

Save and close the file. Next create a text file called /etc/hostapd/hostapd.conf, enter:
Set interface name:

### Wireless network name ###
interface=wlan0

### Set your bridge name ###
bridge=br0

Set driver name:

 
driver=nl80211

Set country name code in ISO/IEC 3166-1 format. This is used to set regulatory domain. Set as needed to indicate country in which device is operating. This can limit available channels and transmit power.

 
### (IN == INDIA, UK == United Kingdom, US == United Stats and so on ) ###
country_code=IN

Set your SSID:

 
ssid=nixcraft

Set operation mode (a = IEEE 802.11a, b = IEEE 802.11b, g = IEEE 802.11g)
hw_mode=g
Set channel number (some driver will only use 0 as value)

 
channel=6

Set wpa mode to 2:

 
wpa=2

Set your passphrase (WiFi password):

 
wpa_passphrase=MyWiFiPassword

Set key and auth optionsmanagement for WPA2:

## Key management algorithms ##
wpa_key_mgmt=WPA-PSK

## Set cipher suites (encryption algorithms) ##
## TKIP = Temporal Key Integrity Protocol
## CCMP = AES in Counter mode with CBC-MAC
wpa_pairwise=TKIP
rsn_pairwise=CCMP

## Shared Key Authentication ##
auth_algs=1

## Accept all MAC address ###
macaddr_acl=0

Save and close the file.

How Do I start / stop / restart AP?

Use the following commands:
# /etc/init.d/hostapd start
# /etc/init.d/hostapd stop
# /etc/init.d/hostapd restart

Step #3: Configure /etc/network/interfaces

You can setup wlan0 in standalone mode or bridge it with eth0. The bridge mode will open your wireless client to access rest of the LAN and you will able to connect to the Internet. Most user bridge the wireless interface with the AP’s Internet-connected interface.

Set br0 (wlan0+eth0) in bridge mode

You need to install bridge-utils package for configuring the Linux Ethernet bridge:
# apt-get install bridge-utils
Sample outputs:

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  bridge-utils
0 upgraded, 1 newly installed, 0 to remove and 15 not upgraded.
Need to get 32.7 kB of archives.
After this operation, 176 kB of additional disk space will be used.
Get:1 http://debian.osuosl.org/debian/ squeeze/main bridge-utils amd64 1.4-5 [32.7 kB]
Fetched 32.7 kB in 1s (25.5 kB/s)
Selecting previously deselected package bridge-utils.
(Reading database ... 267692 files and directories currently installed.)
Unpacking bridge-utils (from .../bridge-utils_1.4-5_amd64.deb) ...
Processing triggers for man-db ...
Setting up bridge-utils (1.4-5) ...

Edit /etc/network/interfaces, enter:
# vi /etc/network/interfaces
Modify or set config as follows:

 
auto lo br0
iface lo inet loopback

# wireless wlan0
allow-hotplug wlan0
iface wlan0 inet manual

# eth0 connected to the ISP router
allow-hotplug eth0
iface eth1 inet manual

# Setup bridge
iface br0 inet static
    bridge_ports wlan0 eth1
    address 192.168.1.11
    netmask 255.255.255.0
    network 192.168.1.0
    ## isp router ip, 192.168.1.2 also runs DHCPD ##
    gateway 192.168.1.2
    dns-nameservers 192.168.1.2

Save and close the file. At this stage I recommend that you reboot the computer or restart all services as follows (may not work over remote ssh session):
# /etc/init.d/networking restart
# /etc/init.d/hostapd restart

OR
# reboot

A note about DHCPD server

Since you are running your WAP in bridge (br0) mode, DHCPD is not required on your WAP. It can use DHCPD server located anywhere on the LAN. In this example 192.168.1.2 is an ISP router with DHCPD running on it.

A note about Firewall

You can install a firewall to protect from attacks. See how to install shorewall on Debian or Ubuntu Linux.

How do I troubleshoot WAP problems?

You will find WPA auth log info in /var/log/syslog file:
# tail -f /var/log/syslog
Find out if DHCPD relay working or not:
# tcpdump -n port 67 or port 68
Make sure firewall is not blocking required ports:
# /sbin/iptables -L -n -v | less
Make sure correct mac address are assigned and br0 is up and running:
# ifconfig br0
# ifconfig | grep HW
brctl show
# brctl showmacs bro

Use these 8 Linux commands to find out wireless network speed, signal strength and other information:

Finally, make sure you use latest version of the following software

  • Linux kernel
  • Wireless card drivers and firmware
  • hostapd
REFERENCES

 

15 SQLite3 SQL Commands Explained with Examples

by RAMESH NATARAJAN on SEPTEMBER 20, 2012, The Geek Stuff

SQLite3 is very lightweight SQL database which focuses on simplicity more than anything else. This is a self-contained serverless database engine, which is very simple to install and use.

While most of the commands in the SQLite are similar to SQL commands of other datbases like MySQL and ORACLE, there are some SQLite SQL commands that are different.

This article explains all the basic SQL commands that you need to know to use the SQLite database effectively.

If you don’t have sqlite installed, execute “yum install sqlite” to install it. You can also install SQLite database from source to get the latest version.

Continuar lendo

Como dar boot em modo de segurança no Mac – para resolução de problemas

Por Augusto Campos em 08/11/2012, BR-MAC

Quando algum problema no boot ou na configuração impede os procedimentos usuais de diagnóstico e solução de problemas, a Inicialização Segura e o Modo de Segurança podem ser parte importante da solução.

Para dar um Safe Boot você deve ligar o Mac e ficar atento ao momento em que soa o sinal sonoro do início do boot: é imediatamente depois dele que você deve pressionar a tecla Shift, e mantê-la pressionada por alguns instantes, até que apareça o símbolo da maçã e o indicador de progresso do boot.

Safe Boot realiza alguns procedimentos para evitar problemas comuns na inicialização, e assim costuma demorar bem mais que o normal. Ao final dele o seu Mac estará no Safe Mode ou Modo de Segurança, no qual vários recursos ficam indisponíveis para aumentar a chance de você ter acesso aos diagnósticos, correções ou procedimentos que poderão resolver a sua situação.

Continuar lendo