Showing posts with label #IP. Show all posts
Showing posts with label #IP. Show all posts

Wednesday, October 18, 2023

To set up a #static #IP #address in #Ubuntu #Server

To set up a static IP address in Ubuntu Server, you'll need to make changes to the network configuration files. Here are the steps to do this:

1. Open a terminal window on your Ubuntu Server. You can do this by either connecting directly to the server or using SSH.

2. Determine the network interface name. You can use the `ifconfig` or `ip a` command to list all available network interfaces. Typically, the primary network interface is named something like "eth0" or "ens32." Note down the name of your interface.

3. Edit the network configuration file for your interface. You can use a text editor like nano or vim. Replace "eth0" with your actual interface name in the following command:

       sudo vim /etc/netplan/01-netcfg.yaml

This file may have a different name depending on your Ubuntu version. The important thing is to edit the YAML file in the `/etc/netplan/` directory.

4. Inside the configuration file, you should see something like this:

yaml

   network:

version: 2

renderer: networkd

ethernets:

   eth0:

dhcp4: true

Change `dhcp4: true` to `dhcp4: false` and add your static IP configuration. Here's an example of a static IP configuration:

yaml

   network:

version: 2

renderer: networkd

ethernets:

   eth0:

dhcp4: false

addresses: [192.168.1.10/24]  # Replace with your desired static IP and subnet mask

gateway4: 192.168.1.1       # Replace with your gateway/router IP

nameservers:

   addresses: [8.8.8.8, 8.8.4.4]  # Replace with your DNS server(s) IP

Customize the IP address, subnet mask, gateway, and DNS server addresses to match your network configuration.

5. Save the changes and close the text editor.

6. Apply the network configuration changes by running:

sudo netplan apply

7. To verify that the static IP address is correctly set up, you can run:

ip a

You should see your configured static IP address associated with your network interface.

8. Finally, to ensure that your changes persist across reboots, you may need to disable the cloud-init network configuration by editing the following file:

   sudo nano /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg

   Add the following lines:

network: {config: disabled}

   Save the file and exit.

9. Reboot your server to apply all changes:

sudo reboot

Your Ubuntu Server should now have a static IP address configured. Make sure that the static IP address you choose is not in use by any other device on your network to avoid IP conflicts.


Thursday, April 27, 2023

Setting Static Ip in Ubuntu using Netplan command and netplan file Using...

Setting up a static IP address on Ubuntu is essential for many reasons, such as making sure that your server is always reachable at the same address or allowing you to set up network services with specific IP addresses. Netplan is the default network configuration tool in Ubuntu 18.04 and later versions. In this article, we will show you how to set up a static IP address using Netplan on Ubuntu.
Before we begin, it's important to note that you will need to have sudo privileges on your Ubuntu server to execute the commands in this tutorial.
Step 1 - Determine Network Interface
The first step in setting up a static IP address is to determine the name of your network interface. You can do this by running the following command:
ip addr show
This command will show you all of the network interfaces on your system. Look for the interface that you want to set up a static IP address for, and take note of the interface name. In most cases, the interface name will be "eth0" or "enp0s3".
Step 2 - Configure Netplan
Next, we need to configure Netplan to use a static IP address for our network interface. Netplan configuration files are located in the /etc/netplan/ directory. The default configuration file is called "50-cloud-init.". You can edit this file with your favorite text editor.
sudo nano /etc/netplan/00-<filename>
This command will open the configuration file in the nano text editor. In this file, you will see a configuration block for your network interface. The configuration block will look something like this:
network:
ethernets:
eth0:
dhcp4: true
version: 2
To configure a static IP address, you need to modify the configuration block for your network interface. Replace the "dhcp4: true" line with the following lines:
address: 192.168.1.100/24
gateway4: 192.168.1.1
nameservers:
addresses: [8.8.8.8,8.8.4.4]
In this example, we are using a static IP address of 192.168.1.100 with a netmask of 24 bits (255.255.255.0). We also need to set the default gateway address to 192.168.1.1 and specify the DNS server addresses.
Save the file and exit the text editor.
Step 3 - Apply Netplan Configuration
After configuring Netplan, you need to apply the changes to make them effective. To do this, run the following command:
sudo netplan apply
This command will apply the changes to the Netplan configuration file and restart the network service.
Step 4 - Verify Static IP Address
To verify that your Ubuntu server is now using a static IP address, run the following command:
ip addr show
This command will show you the current IP addresses for all of your network interfaces. Look for the interface that you configured, and you should see your static IP address listed.
Conclusion
Setting up a static IP address using Netplan on Ubuntu is a straightforward process that can be done in just a few simple steps. By using a static IP address, you can ensure that your server is always reachable at the same address, making it easier to manage and set up network services. Netplan is a powerful tool that can help you manage your network configuration in Ubuntu, and we hope that this tutorial has helped you get started.

Setting #Static Ip in #Ubuntu using #Netplan #command and #netplan file Using #Command line

#StaticIP #Ubuntu #Netplan #IP #Linux #Unix

Tuesday, February 28, 2023

What is #IP Address and #Subnet?

 An IP address is like a phone number for devices on a computer network. It uniquely identifies each device so that they can communicate with each other.

A subnet is a way of dividing a larger network into smaller, more manageable sub-networks. This can be useful for security and organization purposes.

An IP range is a range of IP addresses within a subnet. It is a set of numbers that defines the beginning and end of the range of IP addresses that are available for use within that subnet.

For example, if you have a network with the IP address 192.168.0.0 and a subnet mask of 255.255.255.0, you can divide the network into smaller subnets, such as 192.168.0.0/24, 192.168.0.0/25, or 192.168.0.0/26. Each of these subnets will have its own IP range.

The IP range for a subnet is calculated based on the number of bits in the subnet mask. For example, a subnet mask of /24 means that the first 24 bits of the IP address are used to identify the network, and the remaining 8 bits are available for use within the subnet. So the IP range for a /24 subnet would be from 192.168.0.1 to 192.168.0.254.

In simple words, a subnet is like a neighborhood within a city, and an IP range is like the range of house numbers within that neighborhood. Each neighborhood has its own set of house numbers, and each IP range has its own set of IP addresses that can be used within that subnet.

Featured Posts

Kali Linux Remote Desktop: Access GNOME from Windows Using Native RDP

  Kali Linux + GNOME 50 + GNOME Remote Desktop + Windows Remote Desktop (MSTSC) Getting a full GNOME desktop remotely on Kali Linux can be ...