Cyberworld-builders / academy

A designated place for educational and training docs, materials and exercises. Also a place to track issues and progress and a lab for code that can be potentially used elsewere.
0 stars 0 forks source link

Networking - Configure an OpenWrt Router in Front of Spectrum #49

Open jaylong255 opened 2 months ago

jaylong255 commented 2 months ago

The default credentials for logging into an OpenWrt admin panel are:

However, it's important to note:

  1. Security: These are the default credentials, and for security reasons, you should change them immediately after initial login.

  2. Installation Method: If OpenWrt was installed using certain methods or images, the default password might be different. For example, some pre-configured or community images might use different defaults.

  3. Customization: If someone else set up the router or if you've forgotten changes you made, the credentials could be different from the default.

  4. Recovery: If you've lost access and can't remember changing the defaults, you might need to reset the router to factory settings. This usually involves holding down a reset button for a specified period while powering on the device.

If you've changed the password and forgotten it, or if someone else set it up, you'll need to reset the router or find out the changed credentials from the person who set it up. Always ensure you're connecting securely when accessing router settings.

jaylong255 commented 2 months ago

To change the network from 192.168.x.x to 172.x.x.x in OpenWrt, you'll need to modify the network configuration. Here's a step-by-step guide:

Step 1: Access the LuCI Interface

Step 2: Navigate to Network Settings

Step 3: Edit LAN Interface

Step 4: Change the IP Address

Step 5: Save and Apply

Alternative: Using Command Line

If you prefer or need to use the command line:

  1. SSH into your OpenWrt router using your current IP address.

  2. Edit the network configuration file:

    vi /etc/config/network
  3. Find the config interface 'lan' section and change the option ipaddr and option netmask:

    config interface 'lan'
       option device 'lan'
       option proto 'static'
       option ipaddr '172.16.1.1'
       option netmask '255.255.0.0'
  4. Save and exit the editor (in vi, press Esc, then :wq and Enter).

  5. Restart the network service:

    /etc/init.d/network restart

Important Notes:

Changing the network range can be disruptive, so ensure you're prepared for potential connectivity issues during the transition.

jaylong255 commented 2 months ago

To set up your new OpenWrt router to act as an access point (AP) or switch, connecting to an existing router (which we'll call the "main router") using 10.0.0.1, you'll need to configure the WAN interface of the new router to act as a LAN interface that connects to the main router. Here's how you can do this:

Step 1: Connect the Routers

Step 2: Configure the New Router's WAN Interface as LAN

You'll need to access the new router's configuration, either through the default IP or by SSH if you've already set it up.

Using LuCI Web Interface:

  1. Access LuCI: Go to 192.168.1.1 (or whatever your new router's IP is) in your browser and log in.

  2. Navigate to Network Settings:

    • Go to Network > Interfaces.
  3. Edit WAN Interface:

    • Find the WAN interface and click Edit.
    • Change the Protocol to Static address.
    • Set an IP Address in the same subnet as your main router. For example, if your main router uses 10.0.0.1, you might set your new router to 10.0.0.2 with a Subnet Mask of 255.255.255.0.
  4. Save & Apply: Save these settings. Your new router should now be able to communicate with the main router.

Using Command Line (SSH):

  1. SSH into your new OpenWrt router.

  2. Edit the network configuration file:

    vi /etc/config/network
  3. Modify the WAN interface:

    config interface 'wan'
       option ifname 'eth0'  # Adjust ifname if different
       option proto 'static'
       option ipaddr '10.0.0.2'
       option netmask '255.255.255.0'
       option gateway '10.0.0.1'  # This is the IP of your main router
  4. Save and exit the editor (:wq in vi).

  5. Restart the network service:

    /etc/init.d/network restart

Step 3: Configure DHCP for the New Network

If you want the new router to distribute IP addresses to devices connected to it:

Step 4: Set Up Wireless (If Acting as an Access Point)

If you want the new router to also act as a Wi-Fi access point:

Step 5: Test the Connection

Important Considerations:

This setup effectively turns your new OpenWrt router into an additional access point or switch, extending the network coverage while still being managed by the main router for internet access.