Adding additional IP Address to ethernet interface

Scenario: You have several devices within your network, you’ve changed the address range for the network but you’ve forgotten to change one in particular. It’s easier to log into the device than to physically attend to it (it may be headless, it may not be in your immediate vicinity, or you’re just to lazy to get out of your chair to do it.

Q. How do you log into a network device that isn’t on your subnet?

A. You create an alias IP address for your current interface within the scope of the IP address you need to hit.

In this example we’ve moved a network from a 192.168.0.1 to 10.0.0.1.

The router has been configured, all the devices have been configured and you’re up and running but realised you forgot the file server in the garage. Your whole network is now setup on the 10.0.0.1 network, but the file server is sitting patiently waiting for you back on the 192.168.0.1 network.

Here’s how you would do it in linux (Ubuntu):

>$ ifconfig
enp6s0: flags=4163 mtu 1500
inet 10.0.0.5 netmask 255.255.255.0 broadcast 10.0.0.255
RX packets 6406862 bytes 7485766742 (7.4 GB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 3920089 bytes 1566938600 (1.5 GB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
The old server is at 192.168.0.100, our computer was at 192.168.0.77. You can use any IP address that is not the device you want to connect to, and that is still within the same subnet range.

$ ifconfig enp6s0:0 192.168.0.77 up
Confirm it worked:

enp6s0: flags=4163 mtu 1500
inet 10.0.0.5 netmask 255.255.255.0 broadcast 10.0.0.255
ether 11:22:dd:99:4e:ee txqueuelen 1000 (Ethernet)
RX packets 6413204 bytes 7488178719 (7.4 GB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 3925411 bytes 1568449079 (1.5 GB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

enp6s0:0: flags=4163 mtu 1500
inet 192.168.0.77 netmask 255.255.255.0 broadcast 192.168.0.255
ether 11:22:dd:99:4e:ee txqueuelen 1000 (Ethernet)
note: this won’t survive a reboot. But for most intents and purposes, this will suffice. You can log into the file server and change the IP address and jump back out.

To make it permanent we will need to edit

/etc/network/interfaces
from: https://askubuntu.com/questions/585468/how-do-i-add-an-additional-ip-address-to-an-interface-in-ubuntu-14 (modified only to match the example above)

# vi /etc/network/interfaces
Append the following to the file (This is in addition to existing information, not a replacement for it)

auto eth0:1
iface eth0:1 inet static
name Ethernet alias LAN card
address 192.168.1.7
netmask 255.255.255.0
broadcast 192.168.1.255
network 192.168.1.0
Save and close the file. Restart the network:

# /etc/init.d/networking restart

Back from the Moon, Apollo Astronauts Had to Go Through Customs

Today commemorates 50 years since the moon landing. That means I’m officially half a century old! Not that I remember it, but on that day in July, I was in a baby bassinet watching Armstrong and Aldrin taking their historic steps.

Apparently on their return to Hawaii they filled out a customs declaration. It was more of a joke than anything else at the time. However today it is more of a formality.

For a full copy of the declaration and more of a back story, please visit the below link

from: https://www.space.com/7044-moon-apollo-astronauts-customs.html

Forgotten raspberry pi login password

Today I am working on an old raspberry pi (model B, original version) and need to get this project up and running, but I have forgotten the password.

No problem.

Let’s take the SD card and edit the `cmdline.txt` file in the root directory and add `init=/bin/sh` to the end of it (make sure there is a space before it).

Put it back into the pi and reboot.

On the pi, type:

su
mount -o remount, rw /
passwd pi

and enter your new password. Once done, sync the drive and exit
sync
exit

I like beer

In some of my songs, I have casually mentioned
The fact that I like to drink beer.

This little song, is more to the point,
Roll out the barrels and lend me your ears,

I like beer
It makes me a jolly good fellow,
I like beer
it helps me unwind and sometimes it makes me feel mellow (makes him feel mellow)

Whisky’s too rough,
Champaign costs too much
and Vodka puts my mouth in gear,
This little refrain, should help me explain,
as a matter of fact, I like beer (he likes beer)

My wife often frowns, when We’re on the town,
And I’m wearing a suit and a tie,
She’s sipping vermouth and she thinks I’m uncouth,
when I yell as the waiter goes by,

Whisky’s too rough,
Champaign costs too much
and Vodka puts my mouth in gear,
While this little refrain, should help me explain,
as a matter of fact, I like beer (he likes beer)

Last night I dreamed, that I passed from the scene
and I went to a place so sublime
All the water was clear and tasted like beer
then they turned it all into wine

I like beer
It makes me a jolly good fellow,
I like beer
it helps me unwind and sometimes it makes me feel mellow (makes him feel mellow)

Whisky’s too rough,
Champaign costs too much
and Vodka puts my mouth in gear,
This little refrain, should help me explain,
as a matter of fact, I love beer (yes he likes beer)

journalctl -xef -u some.service

systemctl status … will display an excerpt.

If the error is displayed when starting Caddyserver from a console, but is not shown in the logs if an initdaemon such as systemd is used (which logs stdout and stderr), then Caddyserver’s authors have forgotten to Flush stdout and/or stderr before exiting.

found: https://caddy.community/t/cant-start-caddy-with-systemd-service-file/3447

I wish I’d found this little gem a long time ago!

Psychology in pricing

When you see $9.95, do you think:

  • WOW, $9
  • That’s almost $10
  • That’s $10

When I see fuel is 174.9c although I may say one seventy four in my head (simply because that’s what I’m reading), I recognise the .9 to mean “close enough to one”, and so I think in my head $1.75.

Maybe I think differently to most (I don’t think that’s really the case), but when I see this on facebook, I can’t help but think the writer is an idiot. 

That caption alone: “Try paying $2”. I’m already stuck. I don’t see anything that’s $2, I’m already seeing $3. I’m not even seeing $2.99, that THREE WHOLE DOLLARS. (you AREN’T going to get any change!)

My second thought is, “YES! TRY paying $2 a litre and you’ll be met with a stare followed by a call to the local cops because you’re trying to steal a third of the fuel you just put in your tank!”

And when I read, “which is nearly $3,” my brain is screaming “it IS three dollars!”

Somebody needs a lesson in maths.

That’s not my job, someone needs to go back to school. 

They could also just watch some YouTube videos!

If that’s all too dificult for you, check out these 9.99999̅ reasons. 

Cheers!

Reset admin account login

Ive had to do this more than I care to mention. I should really know it by heart now, but the short version is:

  1. boot into the grub menu and select advanced options
  2. head into recover mode
  3. drop to root shell prompt
  4. you’ll need to remount the filesystem that is currently read only:
    mount -o rw,remount \
  5. change the password:
    passwd <your-username>
  6. exit
  7. you’re done, reboot.

For a guide with pictures,

How to reset your password in Ubuntu