In my last article I have described how to manage manage GSM mobile broadband connections without Network Manager on Debian based distributions like Ubuntu and Linux Mint.
In this article I will show you how to do the same on Red Hat Linux based Linux operating systems like CentOS and Fedora. I recommend that you read "Introduction" and "My hardware and ISP configuration" paragraphs from my last article to get acquainted with my exact hardware and Internet Service Provider configuration. Required procedure is a bit simpler for Red Hat Linux, CentOS and Fedora because there is some abstraction in accessing basic pppd options. Also Red Hat network configuration files are differently arranged (better than Debian in my opinion) and because of all that this article is a bit simpler to follow than it's Debian counterpart.
Step by step procedure (Red Hat Linux, CentOS, Fedora)
First we need to create so called chat script that will communicate directly to your modem hardware and configure things like access point name (APN), timeouts and calling number using AT commands. I will create file named
/etc/sysconfig/network-scripts/ directory to hold my chat script. This is what's inside my
TIMEOUT 10 ABORT 'BUSY' ABORT 'NO ANSWER' ABORT 'ERROR' ABORT 'NO CARRIER' '' 'ATZ' 'OK' 'ATE1' 'OK' 'AT+CGDCONT=1,"IP","ispapn","0.0.0.0",0,0' 'OK' 'ATDT*99#' 'CONNECT' '\c'
You should replace
ispapn with your ISP access point name (APN).
My ISP is using PAP authentication so I must add user name and password provided by my ISP at the end of my
/etc/ppp/pap-secrets file. If your Internet service provider is using CHAP authentication do the same but use
/etc/ppp/chap-secrets file. So here's what I have placed at the end of my
/etc/ppp/pap-secrets file (use your user name and password instead of my
"ispusername" "ppp0" "isppassword"
ppp0 is network interface identification string, usually ppp0 if this is your first dial up interface. You can create many PPP network interfaces with different options so
ppp0 is something to remember for step three. If your ISP isn't using authentication and you don't need to provide name and password to connect to Internet you can skip this step altogether.
Third step is a bit different for RHEL based distributions. RHEL guys decided to bring some user friendlies (not much actually) to adjust pppd settings from standard RHEL network interface configuration file that other scripts are turning into what we had to create as peers file on Debian Linux. Other options we will add manually at the end of RHEL network interface configuration file. This approach is actually good because at the same time you are configuring pppd and creating network interface (for
ifdown). So lets start. We will create file named
/etc/sysconfig/network-scripts/ and place following code inside:
DEVICE=ppp0 MODEMPORT=/dev/ttyUSB0 LINESPEED=115200 PAPNAME=ispusername USERCTL=no ONBOOT=no PERSIST=no DEFROUTE=yes PEERDNS=yes DEMAND=no HARDFLOWCTL=yes PPPOPTIONS='refuse-chap refuse-mschap refuse-mschap-v2 refuse-eap hide-password noauth noipdefault lock novj novjccomp nopcomp nodeflate'
Please don't forget to adjust PAPNAME to your own ISP provided username.Description for all these settings are available on pppd man page (
man pppd), I will explain settings you will most likely need to adjust for your ISP and hardware:
Here you will place interface identification string from /etc/ppp/pap-secrets or /etc/ppp/chap-secrets (
ppp0 in my case). This will also serve as network interface identification name for use with
This is virtual serial port created by your GSM modem device. You will select /dev/ttyUSB0 if you have Huawei E220 device or /dev/ttyUSB2 if you have ZTE MF100 modem device. If you have some other modem device take a look at the “Connection information” window from your Network Manager when you have established Internet connection using Network Manager. That will give you serial device location for your hardware.
Replace with your own ISP provided user name or remove this line if your ISP isn't using authentication. If your ISP is using CHAP authentication replace PAPNAME with CHAPNAME.
Do you want regular users to be able to bring this network interface up or down?
Do you want your Linux operating system to dial to your ISP when it starts?
Due to PEERDNS = yes my example is requesting DNS information from my ISP. To use your own DNS info, for example Google public DNS or OpenDNS, you will need to manually edit
/etc/resolv.conf with your DNS server address every time you dial your ppp0 interface. For example to use Google public DNS servers you would modify
PEERDNS=no and place following inside
nameserver 18.104.22.168 nameserver 22.214.171.124
I recommend configuring manual DNS settings later when you are sure that everything works with
Here you can place any other pppd options from
man pppd that aren't available trough network interface configuration file.
"refuse-X" inside PPPOPTIONS
You will need to modify this for your ISP authentication protocol. You instruct pppd to refuse all authentication protocols except the one you are instructed by your ISP to use (PAP authentication in my case). If your ISP is using CHAP authentication you would modify my example by removing
refuse-chap line and adding
refuse-pap line. If your ISP isn't using authentication you just remove all lines
refuse-X lines from peers file.
That's it and you should be able to use
ifup ppp0 and
ifdown ppp0 to dial to your Internet Service Provider. Good luck!