# Making a Dial In Server MiniHowTo

## taskara

Making a Dial In Server MiniHowTo

With thanks to PowerFactor and VanDan

and this howto by Josh Gentry

This is a guide to help you create a dial in server, so that someone can remotely dial your server via a phone line and connect to your network.

This guide does NOT cover network or internet setup, nor does it cover internet connection sharing or firewalls.

Firstly you need the normal network support in your kernel, as well as TCP/IP protocol.

So, from /usr/src/linux, run

make menuconfig

Under Network Device Support, compile in PPP, PPP support for async serial ports, PPP support for sync tty ports, PPP Deflate compression, SLIP (serial line) support, CSLIP compressed headers, Keepalive and linefill

 [img:a98d47720a]http://www.smartclan.com/images/pppkernel.jpg[/img:a98d47720a]

```
make dep clean bzImage modules modules install

mount /boot

mv arch/i386/boot/bzImage /boot/bzImage-ppp
```

add a new entry into grub or lilo for bzImage-ppp

reboot into your new kernel.

Once you are in your new kernel, emerge the following:

```
emerge ppp mgetty
```

As root, run

```
/usr/sbin/pppd
```

Press Ctrl + C to kill it, and WAIT.

You should see lots of gobbledegook all over the screen.

[img:a98d47720a]http://www.smartclan.com/images/pppd.jpg[/img:a98d47720a]

This shows that you have PPP support built into your system.

Now we have to configure mgetty.

Mgetty is the program that will sit and wait for incoming calls, and then answer them and tell PPP to start the connection.

There are 4 main files you have to configure. We are going to use /etc/password to authenticate users. All linux users to dial up, but restrict those we dont want by not adding them to the ppp group. 

Edit login.config

```
nano -w /etc/mgetty+sendfax/login.config
```

Under AutoPPP section add the following

```
/AutoPPP/ - - /usr/sbin/pppd file /etc/ppp/options.server
```

This tells mgetty to automatically start PPP when a connection is made, and to use the options specified in /etc/ppp/options.server

Now we create that file:

```
nano w /etc/ppp/options.server
```

This is the entry I have in there:

```
debug

asyncmap 0

modem

crtscts

lock

require-pap

refuse-chap

login

proxyarp

ms-dns 192.231.203.132

ms-dns 192.231.203.3

192.168.0.10:192.168.0.20
```

Copy all of the above, changing the ms-dns settings to that of your ISP, and the ip addresses at the bottom.

The ip addresses there are firstly, the address of the server, and then the ip address you will give the dialing in pc. In my case the server is 192.168.0.10, and the dial in machine will be 192.168.0.20.

Now we edit inittab and tell it to start mgetty

```
nano w /etc/inittab
```

and add the following line at the bottom

```
S2:2345:respawn:/usr/sbin/mgetty ttyS0 -D /dev/ttyS0
```

This tells your system to keep mgetty running, and to expect data calls.

Next we need to tell ppp who can authenticate.

This is done through a few steps, the first being an entry in pap-secrets

```
nano -w /etc/ppp/pap-secrets
```

add the following entry:

```
*       *       ""      *
```

This says that anyone can authenticate, from any server. Is this a security risk you ask? Well no its not because we will restrict who can actually start ppp in a moment.

Now you need to create a group called ppp.

```
groupadd ppp
```

Now we change the ownership of pppd to the ppp group.

```
chgrp ppp /usr/sbin/pppd
```

Also we change the permissions so that users can execute it:

```
chmod 4550 /usr/sbin/pppd
```

now check the permissions

```
ls l /usr/sbin/pppd
```

they should look like this:

```
-rwsr-x---    1 root     ppp        249636 Sep 11 22:30 /usr/sbin/pppd
```

Assuming you have a user already on your system, you need to add him/her to the ppp group.

```
usermod -G ppp [username]
```

Dont forget to add all the other groups your user may be a member of  like wheel, audio, cdrom, and games, etc. so it may look something like this:

```
usermod -G ppp,wheel,audio,games,cdrom [username]
```

You will need to do this for every user you want to be able to dial in  and it is the ONLY thing you need to do to enable users to dial in.

If you are dialing into a server, and NOT a router, then you will need to turn on packet forwarding.

```
echo 1 > /proc/sys/net/ipv4/ip_forward
```

Add this to local.start so that it is turned on every reboot.

```
nano -w /etc/conf.d/local.start
```

 *Quote:*   

>  # /etc/conf.d/local.start:
> 
> # $Header: /home/cvsroot/gentoo-src/rc-scripts/etc/conf.d/local.start,v 1.4 200$
> 
> # This is a good place to load any misc.
> ...

 

save and exit.

Obviously, connect your modem, and reboot your machine.

Windows setup:

Make a new dial up connection.

The phone number is your home / office number that the modem is connected to.

Your username is your normal linux login name, with your linux password.

I like to specify is the IP address, and dns settings  but this should not be necessary.

If you do want to, then under protocols, choose TCP/IP and enter in the ip address and dns servers you specified above in options.server.

Dial up and see if you can connect!

I think thats everything. This is what worked for me anyway.

Have fun !

Chris

----------

## devon

Not that I don't appreciate your hard work, but shouldn't this be in Documentation, Tips & Tricks.  :Very Happy: 

----------

## taskara

 :Smile:  thanks, but I dunno if it's good enough.

still, an admin will move it is he/she thinks it's appropriate to.

ta

----------

## grudge

Thanks man, it worked perfect for me. Just what I was looking for. I have one problem now. I have rp-ppoe also running for my adsl connection, but after setting up the dialup it kinda screwed that. The dialup works fine and it looks like it sets the dialed in connections to ppp0, which makes sense. Is there a way to run the dialup server and the adsl-connection on the same pc ? if so, how ?

----------

## taskara

Hey - I haven't done it on the same machine, however I assume it is possible by changing your pppoe connection to ppp1 instead of ppp0.

this is easy enough to do during the adsl-setup configuration.

let me know how you go!

Cheers

----------

## grudge

nope, no such luck. I had a look at the adsl-setup and the only connection related option you can specify is the eth0. I also had a look at any other rp-pppoe config files I could find and nothing. Any ideas ?

----------

## gwydion

This sounds really cool, and I think I'll implement it when I put Gentoo back on my server...

Also, this definitely belongs in Documentation, Tips & Tricks.

----------

## taskara

 *grudge wrote:*   

> nope, no such luck. I had a look at the adsl-setup and the only connection related option you can specify is the eth0. I also had a look at any other rp-pppoe config files I could find and nothing. Any ideas ?

 

hmmm I thought it was at the beginning?

adsl-setup and it asks for a name for the connection? and the default is (ppp0)?

it has to have a name, cause it needs to know what to dial. it is definately ppp0, as you mentioned.

so how to change?

I don't use it so I'm not sure.. but I thought it was like the first option... 

hmmm...

----------

## PowerFactor

grudge: One question. Do you already have nat setup on that machine?  I'm pretty sure you would need nat rather than proxyarp since your machine is directly connected to the internet.

And thanks for the mention taskara.  :Very Happy: 

----------

## taskara

 *PowerFactor wrote:*   

> And thanks for the mention taskara. 

 

LOL not at all!  :Very Happy:  my pleasure

----------

## zephyr1256

Good work, I can't wait to try this out.  Doing this has been one of my projects to do over Christmas break since I got a Powerbook for Christmas(Santa came early  :Smile:  ) and I'd like to have some free dialup internet for when I'm places I don't have ethernet or WLAN access.  I've done bits and pieces of the setup but since much of the documentation seems pretty old, and I haven't been able to test it, its good to hear an detailed approach that worked for a fellow Gentooer.

One question:  if the modem is on the one and only phone line, will it pick up on voice calls(ie, does -D make it treat all calls as data calls, or does it not answer non-data calls)?  That wouldn't be good, because I'd imagine whoever was calling would hear some static.  I see that mgetty has an option to only pickup after a number of rings(-n option), I guess I could put it in the inittab line along with -D, just have to make sure my dialup settings on my Pbook don't cause it to give up if it doesn't answer quickly enough.

----------

## taskara

 *zephyr1256 wrote:*   

> Good work, I can't wait to try this out.  Doing this has been one of my projects to do over Christmas break since I got a Powerbook for Christmas(Santa came early  ) and I'd like to have some free dialup internet for when I'm places I don't have ethernet or WLAN access.  I've done bits and pieces of the setup but since much of the documentation seems pretty old, and I haven't been able to test it, its good to hear an detailed approach that worked for a fellow Gentooer.
> 
> One question:  if the modem is on the one and only phone line, will it pick up on voice calls(ie, does -D make it treat all calls as data calls, or does it not answer non-data calls)?  That wouldn't be good, because I'd imagine whoever was calling would hear some static.  I see that mgetty has an option to only pickup after a number of rings(-n option), I guess I could put it in the inittab line along with -D, just have to make sure my dialup settings on my Pbook don't cause it to give up if it doesn't answer quickly enough.

 

I'm not 100% sure, I never had the need, but I will try it out later.

this may be of interest to you

https://forums.gentoo.org/viewtopic.php?p=711930#711930

Kind regards

----------

## tiny

I made a simple dial in server without the ppp. Only mgetty and login.

I can't find any options for idle time. I would like to set up some options, so server would disconnect when there is no data on line for longer then idle time. I couldnt find any option on client side in minicom either.

Any suggestions?

T.

----------

## Chrisw01

Okay, 1st of, lemme say great howto, I have refered it to numerous people.

2nd, has anyone else experienced the problem of this breaking with the emerge of ppp-2.4.2-r7? I allow family to share my connection and as of tonight, it quit working all together, I finally got it to start working again after hours of pulling my hair out by changing require-pap to refuse-pap this will now allow me to dial back in and share the connection otherwise I get  a username and or password is invalid error.

Any light on this subject please, let me know, IT USED TO WORK FLAWLESSLY!

----------

## dkaplowitz

Looks like a fine guide. I have an old USRobo 56K ext. that I (thankfully!) haven't used in at least 2 years...and I plan to find a use for it. Maybe I'll follow your instructions and set up a dial in VPN.

O/T, but is anyone using their *nix box for a phone answering/fax machine? I'd be curious to know how viable an alternative it is to the standard answering machine.

----------

## randomuser14

Has anyone been able to get wvdial to work with the above setup? I can't get wvdial to authenticate only with ppp (mgetty thinks I want /bin/login instead of /usr/sbin/pppd)?

I have even tried using (in wvdial) "Stupid Mode = 1", but it doesn't seem to help... If anyone can post their client ppp options file (eg /etc/ppp/options.ttyS0) I could verify if mine should be working or not  :Smile: 

----------

## tag

Hi,

I have tried this howto and many others to get mgetty ->AutoPPP to work on a gentoo box.

I am dialing from a windowsXP box to the gentoo box.

I have the following installed:

emerge -vp ppp mgetty

These are the packages that I would merge, in order:

Calculating dependencies ...done!

[ebuild   R   ] net-dialup/ppp-2.4.2-r15  -activefilter -atm -dhcp* -ipv6 -mppe-mppc +pam -radius 0 kB 

[ebuild   R   ] net-dialup/mgetty-1.1.30-r2  -doc 0 kB 

l /usr/sbin/pppd

-r-sr-x---  1 root ppp 231756 Dec 24 10:43 /usr/sbin/pppd*

the mgetty logfile has this:

12/24 13:04:41 yS0    select returned 1

12/24 13:04:41 yS0   checking lockfiles, locking the line

12/24 13:04:41 yS0   makelock(ttyS0) called

12/24 13:04:41 yS0   do_makelock: lock='/var/lock/LCK..ttyS0'

12/24 13:04:41 yS0   lock made

12/24 13:04:41 yS0  wfr: waiting for ``RING''

12/24 13:04:41 yS0   got: [0d][0a]RING[0d]

12/24 13:04:41 yS0    CND: RING

12/24 13:04:41 yS0   wfr: rc=0, drn=0

12/24 13:04:41 yS0    CND: check no: 'none'

12/24 13:04:41 yS0  send: ATA[0d]

12/24 13:04:41 yS0  waiting for ``CONNECT''

12/24 13:04:41 yS0   got: ATA[0d]

12/24 13:04:41 yS0    CND: OKATA[0d][0a]+FDM[0d]

12/24 13:04:56 yS0    CND: +FDM[0a][0d][0a]CONNECT ** found **

12/24 13:04:57 yS0  send: 

12/24 13:04:57 yS0  waiting for ``_''

12/24 13:04:57 yS0   got:  24000/ARQ/V34/LAPM/V42BIS[0d]

12/24 13:04:57 yS0    CND: CONNECT 24000/ARQ/V34/LAPM/V42BIS

12/24 13:04:57 yS0    CND: found: 24000/ARQ/V34/LAPM/V42BIS[0a] ** found **

12/24 13:04:57 yS0   waiting for line to clear (VTIME), read: 

12/24 13:04:57 yS0    looking for utmp entry... (my PID: 27335)

12/24 13:04:57 yS0   utmp + wtmp entry made

12/24 13:04:58 yS0   tio_set_flow_control( HARD )

12/24 13:04:58 yS0   print welcome banner (/etc/issue)

12/24 13:04:58 yS0   getlogname (AUTO_PPP), read:[0d]

12/24 13:05:52 yS0   input finished with '\r', setting ICRNL ONLCR

12/24 13:05:52 yS0   tio_set_flow_control( HARD )

12/24 13:05:52 yS0   print welcome banner (/etc/issue)

12/24 13:05:52 yS0   getlogname (AUTO_PPP), read:[0a]

12/24 13:05:52 yS0   tio_set_flow_control( HARD )

12/24 13:05:52 yS0   print welcome banner (/etc/issue)

12/24 13:05:52 yS0   getlogname (AUTO_PPP), read:NO CARRIER[0d]

12/24 13:05:52 ##### failed dev=ttyS0, pid=27335, got modem error 'NO CARRIER'

PPP is compiled into the kernel and the config files are as you said in the howto - identically  :Wink: 

I never even get to start pppd ... it never gets there ?

Any ideas welcome - Thanks

----------

## tag

bump...

any ideas ? anyone ??

----------

