Limited Connectivity (No Internet Connection) on my Wireless Router

The problem: Limited Connectivity (No Internet Connection)

For more than one year, I had to restart my wireless router for more than 1000 times, just to be able to connect two of my laptops and my phone to the internet. This was really a pain in the ass, because even if I shutdown my laptop then i turn it on, I wouldn’t be able to connect to the internet again unless I restart my router. Even worse, every time my android phone automatically disabled the phone’s wireless to save battery, this meant I had to restart my wireless router again to be able to reconnect my phone to the internet…

All that was until I decided to stop being lazy and do some research on the issue and now the problem is solved and I feel great. If you have a similar problem, then read on and learn how to fix this issue.

Scenario: Multiple Laptops and a smart phone connected to the internet through a Wireless Router

My ISP has provided a DSL Modem to my house, which had no wireless interface and instead had LAN interface to multiple ports through the house . Therefore I had to buy my own wireless router ( in my case: I used ADSL DLINK – 2640 T which I had at home from a previous ISP). This was a wireless DSL Modem with multiple Lan output/input and a wireless interface. So by connecting my ISP’s Lan output to my wireless router input, The router acted as a repeater and I could connect all my devices to it.

How I resolved the problem!

The solution was as easy as disabling my DHCP

The ISP’s DSL Modem was already handling the DHCP for me, so keeping the DHCP enabled in my wireless router was a mistake. Snapshots below show how you can do it on Dlink 2640t. It should be easy for you to find out how to do it in different routers.

Different Scenarios: I still Can’t connect to the internet

While doing my research, I was able to find some common issues many people are facing.

So, If you have a different setup and in the case where your DSL modem is also your wireless router. Try the following:

  • Change DHCP lease time:

    Router Automatically Disconnects my devices, then try to change the DHCP to enabled and set the lease time in the DHCP menu to 99999 instead of 3600.

  • Upgrading Wireless Router Firmware:

    (Only do this at your own risk!!! If something goes wrong, recovering your old firmware might not be an option) If all the above doesn’t work even though you are confident that you have properly setup your wireless router, then it is possible that upgrading the firmware of the wireless router could help. Usually vendors release updated firmwares where known and common bugs are fixes. You can do that by:

  • 1- Visit the vendor’s website, for example dlink.com and search for firmware updates corresponding to the model of your wireless router.

    2- Download the firmware image.

    3- Log in to your wireless device and update the firmware by using the web interface to upload the downloaded firmware image

    Caution:

    1- Only use trusted firmware from a known website, in my case, i found the firmware of Dlink 2640t by searching “dlink ftp server firmware 2640t” which finally led me to this link (ftp://ftp.dlink-me.com/DLink_ME/ADSL/DSL-2640T/Firmwares)
    2- Updating your firmware might reset your configuration, so be sure to have your DSL login information ready in case you loose it + remember to setup your admin password again + your wireless password…

Goodluck, Hope this helps, Please leave a comment if this is helpful to you, It would really make me happy to know that my notes made someone’s life easier :), Thanks

Basic shell commands

Print Text into the standard output

In case you have a variable, use:
echo $variablename

In case you want to print a text prompting a user, use:
echo This text will be printed on the screen

or you may use if you need to space at the end of the line:
echo "This text will be printed on the screen: "

Read Variables from standard input

Read a single variable:

read something
when executing the above shell command, the terminal will pause and wait for user’s input.

Once the user inputs some text and presses enter, the text will be stored in a variable name called $something.

Read multiple variables:

read something1 something2 something3

If user inputs: word1 word2 word3 then it is equivalent to,
$something1 =”word1″
$something2 =”word2″
$something3 =”word3″

If user inputs: word1 then it is equivalent to,
$something1 =”word1″
$something2 =””
$something3 =””

If user inputs: word1 word2 word3 word4 word5 then it is equivalent to,
$something1 =”word1″
$something2 =”word2″
$something3 =”word3 word4 word5″

Output Redirection

the “>” redirects the output into a new file / replaces existing file.

ls -ltr > filelist

The above would save the output of the “ls -ltr” into the filelist file.

the “>>” Appends the standard output of a command into existing file.


echo the above was a list of files found inside the directory: >> filelist
pwd >> filelist

The above would append the output of the first echo statement and the folder path returned by pwd into filelist.

Pipeline commands

Pipeline is the process of using the standard output of one shell program as the standard input of another. This can be done by the usage of the character “|”

program1 | program2

In the above case, the output of program1 is used as input to program2.

Getting an input from a file

To use a file as an input to a script or program requiring standard input, use the “<" character.

Example:
Read filedata < filelist

The above command would place the content of the first line of filelist into $filedata variable.

Listing system processes and displaying memory & CPU usage

System Processes

To list the running processes from within a terminal/ shell, type the command top.


/$ top

OUTPUT:
top - 21:23:56 up 5:25, 3 users, load average: 0.04, 0.08, 0.27
Tasks: 195 total, 1 running, 194 sleeping, 0 stopped, 0 zombie
Cpu(s): 9.1%us, 2.1%sy, 0.0%ni, 88.8%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 3025620k total, 2349540k used, 676080k free, 86940k buffers
Swap: 13631116k total, 0k used, 13631116k free, 1798184k cached

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1473 root 20 0 81692 33m 14m S 10 1.1 11:38.01 Xorg
4659 root 20 0 93804 22m 17m S 13 0.8 0:20.23 gnome-system-mo
3632 root 20 0 95176 14m 10m S 4 0.5 0:07.93 gnome-terminal
...
...
...

Memory usage

vmstat n gives the memory usage cyclically every “n” seconds.
Example

/$ vmstat 3

Sample output:
procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu----
r b swpd free buff cache si so bi bo in cs us sy id wa
0 0 0 542736 90120 1815648 0 0 30 47 417 13 22 3 75 1
1 0 0 542604 90120 1815660 0 0 0 0 222 360 0 1 99 0
0 0 0 542604 90140 1815660 0 0 0 45 239 416 0 1 97 2

CPU usage

Similarly, iostat command is used to monitor the CPU usage.

/$ iostat n

Viewing, Creating and Removing an Alias in Unix / Linux

An alias in unix or linux is a shortcut to a command and its switches.

To view existing aliases, type alias in a terminal:

/$ alias

OUTPUT:

alias h='cd /home'
alias l='ls -CF'
alias la='ls -A'
alias ll='ls -alF'
alias ls='ls --color=auto'

In the example above, if you frequently use a certain directory such as /home/myuser/downloads. Create an alias for this directory for easy access by typing,


alias d='cd /home/myuser/downloads'

After the above statement is executed on the terminal, typing d and pressing ENTER will change current directory to /home/myuser/downloads.

Finally, if you want to remove a previously created alias.

Type:


unalias d

How to shutdown an oracle database?

There are four methods used to shutdown an oracle database.

  • normal (will wait for every session to close before shutdown, very slow)
  • transactional (will wait for every transaction to finish before shutdown, slow but safe)
  • immediate (will terminate every session / transaction and shuts down, fast)
  • abort ( requires instance recovery on startup, slow startup)

 

Example:


SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.

 

 

Shutting Down a database goes through three steps:

 

Step 1: Close the database

Step 2: Unmount the database

Step 3: Shutdown the instance

How to start up an oracle database?

To start up an Oracle database, you need to make sure you have necessary privileges (i.e. logged in as sysdba or sysoper) and then type:

SQL> startup

The above command is enough to start up a database, However, if you need to understand the underlying process of start up read on…

You can startup the database in several modes such as:

  • Restricted ( i.e. Use: startup restrict) which restricts access to users with sufficient privileges
  • suspended ( i.e. Use: startup suspend) which disables changes to database

Step 1 (unmounted database): start up an oracle instance

Oracle tries to find spfileSID.ora, then spfile.ora then initSID.ora. These files define the oracle instance parameters and can be modified dynamically through sqlplus.

if no files are found, starting an oracle instance will fail

To show the default parameter spfile, use the following command

SQL> show parameter spfile

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
spfile                               string      C:APPPRODUCT11.2.0
                                                 DBHOME_2DATABASESPFILEORCL.
                                                 ORA
SQL>

 

Step 2: Database Mounted, Instance is associated with Database

Step 3: Database is opened and is available to users.

 

how to select, alter or drop database logfile in sqlplus?

To select the redo log files in your database, use tables v$logfile and v$log.

The logfiles are organized into groups which are active in a sequential manner. When a log file is full, it is archived and then its status is automatically set to inactive and accordingly the status of the next group will be set to current and new changes will be recorded in the current logfile.


SQL> select group#, member from v$logfile;

GROUP# MEMBER
---------- ---------------------------------------

3 C:APPORADATAORCLREDO03.LOG
2 C:APPORADATAORCLREDO02.LOG
1 C:APPORADATAORCLREDO01.LOG

SQL> select group#, sequence#, archived, status, bytes/1024/1024 "MB" from v$log;

GROUP# SEQUENCE# ARC STATUS  MB
———- ———- — —————- ———-
1               10        NO           CURRENT       50
2               8          NO           INACTIVE      50
3               9          NO           INACTIVE      50

 

For redundancy purposes, you may add new mirror logfiles to the existing logfiles using the SQL statements below.


alter database

SQL> add logfile member 'pathtoyour2ndmemberREDO01b.log' to group 1;

Database altered

SQL> add logfile member 'pathtoyour2ndmemberREDO02b.log' to group 2;

Database altered

SQL> add logfile member 'pathtoyour2ndmemberREDO03b.log' to group 3;

Database altered

SQL> alter system switch logfile;
system altered

SQL> /

system altered

SQL> /

system altered

To drop a database logfile, use the following:

alter database drop logfile group 3