Modify USB Armory DHCP IP Pool

2 minute read

In this post we will modify the default DHCP configuration on the USB Armory so that the DHCP address pool will be between 172.16.0.2 and 172.16.0.254 instead of 10.0.0.2 - 10.0.0.254.

Mounting the SD card

Get the USB Armory SD card and plug it in your computer.

We retrieve the location of the SD card with dmesg.

dmesg | tail
[ 6585.912905] usbcore: registered new interface driver usb-storage
[ 6585.913908] usbcore: registered new interface driver uas
[ 6586.914159] scsi 6:0:0:0: Direct-Access     Generic- SD/MMC/MS PRO    1.00 PQ: 0 ANSI: 4
[ 6586.915257] sd 6:0:0:0: Attached scsi generic sg5 type 0
[ 6587.746850] sd 6:0:0:0: [sde] 62333952 512-byte logical blocks: (31.9 GB/29.7 GiB)
[ 6587.747347] sd 6:0:0:0: [sde] Write Protect is off
[ 6587.747357] sd 6:0:0:0: [sde] Mode Sense: 2f 00 00 00
[ 6587.747853] sd 6:0:0:0: [sde] Write cache: disabled, read cache: enabled, doesn''t support DPO or FUA
[ 6587.750287]  sde: sde1
[ 6587.751805] sd 6:0:0:0: [sde] Attached SCSI removable disk

Here we see that the SD card is located at /dev/sde. We can verify that this is indeed the correct device with fdisk -l /dev/sde (we know that our card size is about 32GB).

sudo fdisk -l /dev/sde
Disk /dev/sde: 29,7 GiB, 31914983424 bytes, 62333952 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x7e2bdd5b

Device     Boot Start     End Sectors  Size Id Type
/dev/sde1       10240 7167999 7157760  3,4G 83 Linux

We create a directory where the SD card will be mounted.

sudo mkdir /mnt/usbarmory

And mount the SD card :

sudo mount /dev/sde1 /mnt/usbarmory

Modifying the IP adressess

We start by modifying the network interface IP addresses. We edit the file with:

vim /mnt/usbarmory/etc/network/interfaces

And we modify it so that it looks like this

/mnt/usbarmory/etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d
auto usb0
allow-hotplug usb0
iface usb0 inet static
  address 172.16.0.1
  netmask 255.255.255.0
  gateway 172.16.0.2  

Then we modify the DHCP server configuration:

vim /mnt/usbarmory/etc/dhcp/dhcpd.conf
/mnt/usbarmory/etc/dhcp/dhcpd.conf
# A slightly different configuration for an internal subnet.
subnet 172.16.0.0 netmask 255.255.255.0 {
  range 172.16.0.2 172.16.0.2;
  default-lease-time 600;
  max-lease-time 7200;
}

Finally we can unmount our SD card

sudo umount /mnt/usbarmory
sync

Test it

Put back the SD card in the USB Armory, plug it in your computer. You should be automatically connected to a new network. Try connecting to the USB Armory with :

ssh usbarmory@172.16.0.1 -o PasswordAuthentication=yes