diff --git a/Networking/Debian-Static_IP b/Networking/Debian-Static_IP new file mode 100644 index 0000000..49d8f2f --- /dev/null +++ b/Networking/Debian-Static_IP @@ -0,0 +1,126 @@ +**Debian Specific Static IP Address Setup** + +Get the interface name by looking at + +``` +ip a +``` + +Example - here the interface we are targeting is enp1s0 + +``` +~$ ip a +1: lo: mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 + link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 + inet 127.0.0.1/8 scope host lo + valid_lft forever preferred_lft forever + inet6 ::1/128 scope host noprefixroute + valid_lft forever preferred_lft forever +2: enp1s0: mtu 1500 qdisc fq_codel state UP group default qlen 1000 + link/ether 52:54:00:0c:f6:e7 brd ff:ff:ff:ff:ff:ff + altname enx5254000cf6e7 + inet 192.168.50.80/24 brd 192.168.50.255 scope global dynamic noprefixroute enp1s0 + valid_lft 85984sec preferred_lft 75184sec + inet6 2404:4400:4181:9200:5054:ff:fe0c:f6e7/64 scope global dynamic mngtmpaddr proto kernel_ra + valid_lft 86366sec preferred_lft 86366sec + inet6 2404:4400:4181:9200:617f:906e:3877:3f00/64 scope global dynamic mngtmpaddr noprefixroute + valid_lft 86366sec preferred_lft 86366sec + inet6 fe80::b2a2:4462:bece:c8b7/64 scope link + valid_lft forever preferred_lft forever +~$ +``` + +We will be updated the interfaces file int he networking dir. +Before we do anything we always make a backup copy + +``` +sudo cp /etc/network/interfaces /etc/network/interfaces.bak +``` + +looking at the interface file its shows that the interface is set to dynamic + +** Orginal interface file + +``` +# This file describes the network interfaces available on your system +# and how to activate them. For more information, see interfaces(5). + +source /etc/network/interfaces.d/* + +# The loopback network interface +auto lo +iface lo inet loopback + +# The primary network interface +allow-hotplug enp1s0 +iface enp1s0 inet dhcp +# This is an autoconfigured IPv6 interface +iface enp1s0 inet6 auto +``` + +We will update the ***face enp1s0 inet dhcp*** + +section to look like this + +Example of updated file + +# This file describes the network interfaces available on your system +# and how to activate them. For more information, see interfaces(5). + +source /etc/network/interfaces.d/* + +# The loopback network interface +auto lo +iface lo inet loopback + +# The primary network interface +allow-hotplug enp1s0 +iface enp1s0 inet static + address 192.168.50.20 + netmask 255.255.255.0 + gateway 192.168.50.254 + dns-nameservers 192.168.50.254 8.8.8.8 +# This is an autoconfigured IPv6 interface +iface enp1s0 inet6 auto + +After you have made this edit you can restart the service to get the new IP address + +``` +luddie@Node1-master:~$ ip a +1: lo: mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 + link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 + inet 127.0.0.1/8 scope host lo + valid_lft forever preferred_lft forever + inet6 ::1/128 scope host noprefixroute + valid_lft forever preferred_lft forever +2: enp1s0: mtu 1500 qdisc fq_codel state UP group default qlen 1000 + link/ether 52:54:00:0c:f6:e7 brd ff:ff:ff:ff:ff:ff + altname enx5254000cf6e7 + inet 192.168.50.20/24 brd 192.168.50.255 scope global enp1s0 + valid_lft forever preferred_lft forever + inet 192.168.50.80/24 brd 192.168.50.255 scope global secondary dynamic noprefixroute enp1s0 + valid_lft 86372sec preferred_lft 75572sec + inet6 2404:4400:4181:9200:617f:906e:3877:3f00/64 scope global dynamic mngtmpaddr noprefixroute + valid_lft 86369sec preferred_lft 86369sec + inet6 2404:4400:4181:9200:5054:ff:fe0c:f6e7/64 scope global dynamic mngtmpaddr proto kernel_ra + valid_lft 86369sec preferred_lft 86369sec + inet6 fe80::b2a2:4462:bece:c8b7/64 scope link + valid_lft forever preferred_lft forever +luddie@Node1-master:~$ +``` + +The network is now available via the updated ip address... HOWEVER did you see the old IP is still there? + +``` +inet 192.168.50.80/24 brd 192.168.50.255 scope global secondary dynamic noprefixroute enp1s0 + valid_lft 86372sec preferred_lft 75572sec +``` + +Easiest way of dealing with this... + +``` +sudo reboot + +``` + +And when the machine comes back up, ssh using the newly statically assigned IP address. diff --git a/Networking/Hostname.md b/Networking/Hostname.md new file mode 100644 index 0000000..07e4f11 --- /dev/null +++ b/Networking/Hostname.md @@ -0,0 +1,53 @@ +**Setup Hostname** + +Log into the hostname (ssh) + +Run the following command + +``` +sudo hostnamectl set-hostname NewHostName +``` + +Also need to update the hosts name + +``` +sudo vi /etc/hosts +``` + +***Example of old host file*** + +``` +127.0.0.1 localhost +127.0.1.1 old-hostname.vocus.co.nz old-hostname + +# The following lines are desirable for IPv6 capable hosts +::1 localhost ip6-localhost ip6-loopback +ff02::1 ip6-allnodes +ff02::2 ip6-allrouters +``` + +***Example of updated host*** + +``` +127.0.0.1 localhost +127.0.1.1 New-hostname.vocus.co.nz New-hostname + +# The following lines are desirable for IPv6 capable hosts +::1 localhost ip6-localhost ip6-loopback +ff02::1 ip6-allnodes +ff02::2 ip6-allrouters + +``` + +While hostnamectl typically applies the changes immediately, some services or applications might still be referencing the old hostname. You can restart network services or reboot the system for a complete refresh, although often it's not strictly necessary. +To restart network services: + +``` +sudo systemctl restart network-online.target +``` + +or just reboot + +``` +Sudo Reboot +``` \ No newline at end of file