# Temporary Network Configuration Guideline (Linux)

This guideline describes how to set up a temporary network configuration on a Linux server using `ip` commands. These changes will only persist until the next reboot.

* * *

## **1\. Identify Your Network Interface**

Check available network interfaces and note the one you want to configure (e.g., `ens3`).

```bash
ip link show
```

* * *

## **2\. Flush Existing IP Addresses**

Remove all current IP addresses from your interface to avoid conflicts.

```bash
sudo ip addr flush dev ens3
```

> Replace `ens3` with your actual interface name.

* * *

## **3\. Assign a New IP Address**

Set the desired IP address and subnet mask.

```bash
sudo ip addr add 51.1.1.51/24 dev ens3
```

*   `51.1.1.51` is the new IP.
    
*   `/24` is the subnet mask (255.255.255.0).
    

* * *

## **4\. Bring the Interface Up**

Activate the interface if it is down.

```bash
sudo ip link set ens3 up
```

* * *

## **5\. Set Up Routing**

### **a. Add a Static Route (Optional)**

If you need to reach a specific host directly:

```bash
sudo ip route add 15.2.2.15 dev ens3
```

### **b. Set the Default Gateway**

Direct all traffic through the gateway:

```bash
sudo ip route add default via 15.2.2.15
```

* * *

## **6\. Configure DNS**

Set a DNS server to resolve domain names.

```bash
echo "nameserver 8.8.8.8" | sudo tee /etc/resolv.conf
```

> This replaces your `/etc/resolv.conf` with Google’s DNS.  
> **Note:** Changes to `/etc/resolv.conf` are also temporary and may be overwritten by network managers.

* * *

## **7\. Automatic Setup Script**

You can use the following shell script to automate this temporary network setup.  
This script will prompt you for the required details and apply the configuration.

```bash
#!/bin/bash

# Temporary Linux Network Configuration (Interactive Script)

echo "=== Temporary Network Configuration ==="

# Prompt for network interface
read -p "Enter the network interface name (e.g., ens3): " IFACE

# Prompt for new IP address (with CIDR)
read -p "Enter the new IP address with CIDR (e.g., 192.168.1.100/24): " IPADDR

# Prompt for Gateway
read -p "Enter the gateway IP address (e.g., 192.168.1.1): " GATEWAY

# Prompt for DNS
read -p "Enter the DNS server IP (e.g., 8.8.8.8): " DNS

echo ""
echo "Applying network changes..."

# Flush existing IP addresses
sudo ip addr flush dev "$IFACE"

# Assign new IP address
sudo ip addr add "$IPADDR" dev "$IFACE"

# Bring the interface up
sudo ip link set "$IFACE" up

# Add default gateway
sudo ip route add default via "$GATEWAY"

# Set DNS server
echo "nameserver $DNS" | sudo tee /etc/resolv.conf

echo ""
echo "Network configuration applied (temporarily, until reboot)."
echo "Current network status:"
ip addr show "$IFACE"
ip route

echo ""
echo "Test connectivity (ping DNS server):"
ping -c 4 "$DNS"

echo ""
echo "Done."
```

**Usage:**

1.  Save as `network_setup_`[`prompt.sh`](http://prompt.sh).
    
2.  Make executable: `chmod +x network_setup_`[`prompt.sh`](http://prompt.sh)
    
3.  Run: `./network_setup_`[`prompt.sh`](http://prompt.sh)
    
4.  Follow prompts to input interface, IP address, gateway, and DNS.
    

**Note:**  
This configuration is temporary and will be lost after a reboot. For permanent changes, edit your network configuration files.

* * *

## **8\. Verify Configuration**

### **a. Check IP Address**

```bash
ip a
```

### **b. Check Routing Table**

```bash
ip route
```

### **c. Test Connectivity**

*   Ping gateway or external IP:
    
    ```bash
    ping -c 4 8.8.8.8
    ```
    
*   Test DNS:
    
    ```bash
    ping -c 4 google.com
    ```
    

* * *

## **9\. (Optional) Install Open vSwitch**

If you need Open vSwitch for virtual networking:

```bash
sudo apt update
sudo apt install openvswitch-switch
```

* * *

## **10\. Notes**

*   **Temporary:** These changes will be lost after a reboot. For permanent changes, edit your network configuration files (e.g., `/etc/network/interfaces`, Netplan, or NetworkManager settings).
    
*   **Permissions:** All commands require root privileges (`sudo`).
    
*   **Interface Name:** Replace `ens3` with your actual interface name.
    

* * *

## **11\. Troubleshooting**

*   If network is not working, check:
    
    *   IP address assignment: `ip a`
        
    *   Routing table: `ip route`
        
    *   DNS settings: `cat /etc/resolv.conf`
        
    *   Interface status: `ip link show ens3`
        
*   Re-run commands if you made a mistake or want to reset.
    

### CONTACT:

I’m Kumar Bishojit Paul, the Founder and CEO of [BIKIRAN](https://www.bikiran.com/). If you need further assistance, please leave a comment. I’m interested in helping you.


---

## 🏢 About Bikiran

**[Bikiran](https://bikiran.com/)** is a software development and cloud infrastructure company founded in 2012, headquartered in Khulna, Bangladesh. With 15,000+ clients and over a decade of experience, Bikiran builds and operates a suite of products spanning domain services, cloud hosting, app deployment, workflow automation, and developer tools.

| SL  | Topic        | Product                                                              | Description                                             |
| --- | ------------ | -------------------------------------------------------------------- | ------------------------------------------------------- |
| 1   | Website      | [Bikiran](https://bikiran.com/)                                      | Main platform — Domain, hosting & cloud services        |
| 2   | Website      | [Edusoft](https://www.edusoft.com.bd/)                               | Education management software for institutions          |
| 3   | Website      | [n8n Clouds](https://n8nclouds.com/)                                 | Managed n8n workflow automation hosting                 |
| 4   | Website      | [Timestamp Zone](https://www.timestamp.zone/)                        | Unix timestamp converter & timezone tool                |
| 5   | Website      | [PDFpi](https://pdfpi.bikiran.com/)                                  | Online PDF processing & manipulation tool               |
| 6   | Website      | [Blog](https://blog.bikiran.com/)                                    | Technical articles, guides & tutorials                  |
| 7   | Website      | [Support](https://support.bikiran.com/)                              | 24/7 customer support portal                            |
| 8   | Website      | [Probackup](https://probackup.bikiran.com/)                          | Automated database backup for SQL, PostgreSQL & MongoDB |
| 9   | Service      | [Domain](https://www.bikiran.com/domain)                             | Domain registration, transfer & DNS management          |
| 10  | Service      | [Hosting](https://www.bikiran.com/services/hosting/web)              | Web, app & email hosting on NVMe SSD                    |
| 11  | Service      | Email & SMS                                                          | Bulk email & SMS notification service                   |
| 12  | npm          | [Chronopick](https://www.npmjs.com/package/@bikiran/chronopick)      | Date & time picker React component                      |
| 13  | npm          | [Rich Editor](https://www.npmjs.com/package/@bikiran/editor)         | WYSIWYG rich text editor for React                      |
| 14  | npm          | [Button](https://www.npmjs.com/package/@bikiran/button)              | Reusable React button component library                 |
| 15  | npm          | [Electron Boilerplate](https://www.npmjs.com/package/create-edx-app) | CLI to scaffold Electron.js project templates           |
| 16  | NuGet        | [Bkash](https://www.nuget.org/packages/Bikiran.Payment.Bkash)        | bKash payment gateway integration for .NET              |
| 17  | NuGet        | [Bikiran Engine](https://www.nuget.org/packages/Bikiran.Engine)      | Core .NET engine library for Bikiran services           |
| 18  | Open Source  | [PDFpi](https://github.com/bikirandev/pdfpi)                         | PDF processing tool — open source                       |
| 19  | Open Source  | [Bikiran Engine](https://github.com/bikirandev/Bikiran.Engine)       | Core .NET engine — open source                          |
| 20  | Open Source  | [Drive CLI](https://github.com/bikirandev/DriveCLI)                  | CLI tool to manage Google Drive from terminal           |
| 21  | Docker       | [Pgsql](https://github.com/bikirandev/docker-pgsql)                  | Docker setup for PostgreSQL                             |
| 22  | Docker       | [n8n](https://github.com/bikirandev/docker-n8n)                      | Docker setup for n8n automation                         |
| 23  | Docker       | [Pgadmin](https://github.com/bikirandev/docker-pgadmin)              | Docker setup for pgAdmin                                |
| 24  | Social Media | [LinkedIn](https://www.linkedin.com/company/bikiran12)               | Bikiran on LinkedIn                                     |
| 25  | Social Media | [Facebook](https://www.facebook.com/bikiran12)                       | Bikiran on Facebook                                     |
| 26  | Social Media | [YouTube](https://www.youtube.com/@bikiranofficial)                  | Bikiran on YouTube                                      |
| 27  | Social Media | [FB n8nClouds](https://www.facebook.com/n8nclouds)                   | n8n Clouds on Facebook                                  |
