- hostapd - configure an access point
- hostapd.enable(options, callback) - host an access point
- hostapd.disable(interface, callback) - stop hosting an access point
- ifconfig - configure network interfaces
- ifconfig.status(callback) - status of all network interfaces
- ifconfig.status(interface, callback) - status of a network interface
- ifconfig.down(interface, callback) - take down a network interface
- ifconfig.up(options, callback) - bring up a network interface
- iwconfig - configure wireless network interfaces
- iwconfig.status(callback) - status of all wireless network interfaces
- iwconfig.status(interface, callback) - status of a wireless network interface
- iwlist - query wireless network interfaces
- iwlist.scan(interface, callback) - scan for wireless networks
- udhcpc - configure a dhcp client
- udhcpc.enable(options, callback) - start a dhcp client
- udhcpc.disable(interface, callback) - stop a dhcp client
- udhcpd - configure a dhcp server
- udhcpd.enable(options, callback) - start a dhcp server
- udhcpd.disable(interface, callback) - stop a dhcp server
- wpa_supplicant - configure a wireless network connection
- wpa_supplicant.enable(options, callback) - connect to a wireless network
- wpa_supplicant.disable(interface, callback) - disconnect from a wireless network
The hostapd command is used to configure wireless access points.
The hostapd enable command is used to host an access point on a specific wireless interface.
var hostapd = require('wireless-tools/hostapd');
var options = {
channel: 6,
driver: 'rtl871xdrv',
hw_mode: 'g',
interface: 'wlan0',
ssid: 'RaspberryPi',
wpa: 2,
wpa_passphrase: 'raspberry'
};
hostapd.enable(options, function(err) {
// the access point was created
});
The hostapd disable command is used to stop hosting an access point on a specific wireless interface.
var hostapd = require('wireless-tools/hostapd');
hostapd.disable('wlan0', function(err) {
// no longer hosting the access point
});
The ifconfig command is used to configure network interfaces.
The ifconfig status command is used to query the status of all configured interfaces.
var ifconfig = require('wireless-tools/ifconfig');
ifconfig.status(function(err, status) {
console.log(status);
});
// =>
[
{
interface: 'eth0',
link: 'ethernet',
address: 'b8:27:eb:da:52:ad',
ipv4_address: '192.168.1.2',
ipv4_broadcast: '192.168.1.255',
ipv4_subnet_mask: '255.255.255.0',
up: true,
broadcast: true,
running: true,
multicast: true
},
{
interface: 'lo',
link: 'local',
ipv4_address: '127.0.0.1',
ipv4_subnet_mask: '255.0.0.0',
up: true,
running: true,
loopback: true
},
{
interface: 'wlan0',
link: 'ethernet',
address: '00:0b:81:95:12:21',
ipv4_address: '192.168.10.1',
ipv4_broadcast: '192.168.10.255',
ipv4_subnet_mask: '255.255.255.0',
up: true,
broadcast: true,
multicast: true
}
]
The ifconfig interface status command is used to query the status of a specific interface.
var ifconfig = require('wireless-tools/ifconfig');
ifconfig.status('eth0', function(err, status) {
console.log(status);
});
// =>
{
interface: 'eth0',
link: 'ethernet',
address: 'b8:27:eb:da:52:ad',
ipv4_address: '192.168.1.2',
ipv4_broadcast: '192.168.1.255',
ipv4_subnet_mask: '255.255.255.0',
up: true,
broadcast: true,
running: true,
multicast: true
}
The ifconfig down command is used to take down an interface that is up.
var ifconfig = require('wireless-tools/ifconfig');
ifconfig.down('wlan0', function(err) {
// the interface is down
});
The ifconfig up command is used to bring up an interface with the specified configuration.
var ifconfig = require('wireless-tools/ifconfig');
var options = {
interface: 'wlan0',
ipv4_address: '192.168.10.1',
ipv4_broadcast: '192.168.10.255',
ipv4_subnet_mask: '255.255.255.0'
};
ifconfig.up(options, function(err) {
// the interface is up
});
The iwconfig command is used to configure wireless network interfaces.
The iwconfig status command is used to query the status of all configured wireless interfaces.
var iwconfig = require('wireless-tools/iwconfig');
iwconfig.status(function(err, status) {
console.log(status);
});
// =>
[
{
interface: 'wlan0',
access_point: '00:0b:81:95:12:21',
frequency: 2.437,
ieee: '802.11bg',
mode: 'master',
noise: 0,
quality: 77,
sensitivity: 0,
signal: 50,
ssid: 'RaspberryPi'
},
{
interface: 'wlan1',
frequency: 2.412,
mode: 'auto',
noise: 0,
quality: 0,
sensitivity: 0,
signal: 0,
unassociated: true
}
]
The iwconfig interface status command is used to query the status of a specific wireless interface.
var iwconfig = require('wireless-tools/iwconfig');
iwconfig.status('wlan0', function(err, status) {
console.log(status);
});
// =>
{
interface: 'wlan0',
access_point: '00:0b:81:95:12:21',
frequency: 2.437,
ieee: '802.11bg',
mode: 'master',
noise: 0,
quality: 77,
sensitivity: 0,
signal: 50,
ssid: 'RaspberryPi'
}
The iwlist command is used to get detailed information from a wireless interface.
The iwlist scan command is used to scan for wireless networks visible to a wireless interface. For convenience, the networks are sorted by signal strength.
var iwlist = require('wireless-tools/iwlist');
iwlist.scan('wlan0', function(err, networks) {
console.log(networks);
});
// =>
[
{
address: '00:0b:81:ab:14:22',
ssid: 'BlueberryPi',
mode: 'master',
frequency: 2.437,
channel: 6,
security: 'wpa',
quality: 48,
signal: 87
},
{
address: '00:0b:81:95:12:21',
ssid: 'RaspberryPi',
mode: 'master',
frequency: 2.437,
channel: 6,
security: 'wpa2',
quality: 58,
signal: 83
},
{
address: '00:0b:81:cd:f2:04',
ssid: 'BlackberryPi',
mode: 'master',
frequency: 2.437,
channel: 6,
security: 'wep',
quality: 48,
signal: 80
},
{
address: '00:0b:81:fd:42:14',
ssid: 'CranberryPi',
mode: 'master',
frequency: 2.437,
channel: 6,
security: 'open',
quality: 32,
signal: 71
}
]
The udhcpc command is used to configure a dhcp client for a network interface.
The udhcpc enable command is used to start a dhcp client on a specific network interface.
var udhcpc = require('wireless-tools/udhcpc');
var options = {
interface: 'wlan0'
};
udhcpc.enable(options, function(err) {
// the dhcp client was started
});
The udhcpc disable command is used to stop a dhcp client on a specific network interface.
var udhcpc = require('wireless-tools/udhcpc');
udhcpc.disable('wlan0', function(err) {
// the dhcp client was stopped
});
The udhcpd command is used to configure a dhcp server for a network interface.
The udhcpd enable command is used to start a dhcp server on a specific network interface.
var udhcpd = require('wireless-tools/udhcpd');
var options = {
interface: 'wlan0',
start: '192.168.10.100',
end: '192.168.10.200',
option: {
router: '192.168.10.1',
subnet: '255.255.255.0',
dns: [ '4.4.4.4', '8.8.8.8' ]
}
};
udhcpd.enable(options, function(err) {
// the dhcp server was started
});
The udhcpd disable command is used to stop a dhcp server on a specific network interface.
var udhcpd = require('wireless-tools/udhcpd');
udhcpd.disable('wlan0', function(err) {
// the dhcp server was stopped
});
The wpa_supplicant command is used to configure a wireless network connection for a network interface.
The wpa_supplicant enable command is used to join a wireless network on a specific network interface.
var wpa_supplicant = require('wireless-tools/wpa_supplicant');
var options = {
interface: 'wlan0',
ssid: 'RaspberryPi',
passphrase: 'raspberry',
driver: 'wext'
};
wpa_supplicant.enable(options, function(err) {
// connected to the wireless network
});
The wpa_supplicant disable command is used to disconnect from a wireless network on a specific network interface.
var wpa_supplicant = require('wireless-tools/wpa_supplicant');
wpa_supplicant.disable('wlan0', function(err) {
// disconnected from wireless network
});