Use ISDN Dial Using ISDN Under Linux

zhaozj2021-02-08  246

Use ISDN Dial Using ISDN Under Linux

Zhang Zhonghua (Mike_Z@21cn.com), 2000.12.02 Task: On a Linux machine, dial-up Internet access via ISDN. After trying, I successfully did this. My configuration is: Blue Point Linux 2.0, Kernel-2.2.16, ISDN4LINUX V3.1PRE1, Shanghai Bell produced ISDN built-in card, model is SBT6021. Here is a specific practice. The order of introduction is: kernel -> isDN4linux installation -> Dial-up Configuration -> Test. 1, the kernel Shanghai Bell SBT6021 ISDN built-in card, using the chip for WinBond W6692, is a chip compatible with Siemens Hisax driver, the card is plug-and-play, no manual setting interrupt request number and I / O Address. To Linux kernel support this card, you must select the following options when compiling the kernel: ISDN SupportSupport Synchronous PPP (Most ISDN Device Dial Internet access is used using synchronization PPP mode) Hisax Siemenschipset Driver Supporthisax Support for DSS1 (most ISDN device used The agreement is DSS1) Hisax Support for WinBond W6692, but I don't have to rush to compile the kernel. Why do I repeat if the existing kernel already contains these options? Then how do I know if the existing kernel already contains these options? Looking at the kernel compilation profile /usr/src/linux/.config (Note: The file name "with". "Is a hidden file. It is necessary to use LS -A to see.) I saw the following 5 lines Content, corresponding to five options: config_isdn = mconfig_isdn_ppp = yconfig_isdn_drv_hisax = mconfig_hisax_euro = y "= y" means kernel direct support (code has been lined into the kernel), "= m" indicates module support (code in additional In the kernel, it can be loaded from the kernel). So this shows that the original kernel of the blue point Linux 2.0 has contains these options, I don't have to recompile the kernel. 2, ISDN4Linux installation wants to configure ISDN to use the software of ISDN4Linux. The main files of ISDN4Linux are ISDNCTRL, IPPPPD, etc. Get the address of the ISDN4Linux source code as: http: //isdn4linux.org The file obtained is ISDN4K-Utils.v3.1pre1.tar.gz, put in the / usr / src directory. Enter the / usr / src directory to start the installation process. Enter / usr / src: CD / USR / SRC unconverts compressed file: TAR XZVF ISDN4K-UTILS.V3.1PRE1.TAR.GZ command After completing a subdirectory ISDN4K-UTILS, ISDN4LINUX source file is here. Enter the subdirectory: CD ISDN4K-Utils This directory is described in detail how to install ISDN4LINUX, and you can act as an obstacle. Configuration: make config does not do any changes, use default. Start compilation: Make failed, failure causes the Linux / AutoConf.h file or directory does not exist. This file is /usr/include/linux/autoconf.h file, and one check does not exist.

It is generated when compiling the kernel, and I didn't compile the kernel, so of course there is no. Ok, try the way to generate it. Go to the Linux directory and configure: CD / USR / SRC / Linuxmake MenuConfig does not make any changes, exit, save. At this point, / usr / include / linux / autoconf.h file is out, this is enough, don't really compile the kernel.

Back then compile isdn4linux directory: cd / usr / src / isdn4k-utilsmake previous question is no, but still failed to pass because of the failure is capi20 / capi20.c file in the following several undefined symbol: CAPI_GET_FLAGSCAPI_SET_FLAGSCAPI_CLR_FLAGSCAPI_NCCI_GETUNITCAPI_NCCI_OPENCOUNT corresponding period of the source code: intcapi20ext_get_flags (unsigned ApplID, unsigned * flagsptr) {if (ioctl (applid2fd (ApplID), CAPI_GET_FLAGS, flagsptr) <0) return CapiMsgOSResourceErr; return CapiNoError;} intcapi20ext_set_flags (unsigned ApplID, unsigned flags) {if (ioctl (applid2fd (ApplID), CAPI_SET_FLAGS, & flags) <0) return CapiMsgOSResourceErr; return CapiNoError;} intcapi20ext_clr_flags (unsigned ApplID, unsigned flags) {if (ioctl (applid2fd (ApplID), CAPI_CLR_FLAGS, & flags) <0) return CapiMsgOSResourceErr; return CapiNoError;} char * capi20ext_get_tty_devname (unsigned applid, unsigned ncci, char * buf, size_t size) {int unit; unit = ioctl (applid2fd (applid), CAPI_NCCI_GETUNIT, & ncci); if (unit <0) return 0; snprintf (buf, size, "/ dev / CAPI /% D", UNIT); RETURN BUF;} char * CAPI20EXT_GET_RAW_DEVNAME (unsigned Applid, unsigned ncci, char * buf, size_t size) {int Unit ; unit = ioctl (Applid2FD (Applid), CAPI_NCCI_GetUnit, & NCCI); IF (Unit <0) Return 0; SnPrintf (buf, size, "/ dev / CAPI / R% D", Unit); return buf;} int CAPI20EXT_NCCI_OpenCount (unsigned applict, capi_ncci_opencount, capi_ncci_opencount, & ncci);} The author did not define them, I don't know how much this constant is, what should I do? I found out from the CAPI20 / CAPI20.h file, these functions are "Extentions Functions (No Standard Functions", extended non-standard functions, I guess, even if the function is incorrect, it will not affect ISDN. Using, then I can disconnect the undefined symbols to compile.

Source modified as follows: intcapi20ext_get_flags (unsigned ApplID, unsigned * flagsptr) {// if (ioctl (applid2fd (ApplID), CAPI_GET_FLAGS, flagsptr) <0) // return CapiMsgOSResourceErr; return CapiNoError;} intcapi20ext_set_flags (unsigned ApplID, unsigned flags) { // if (ioctl (applid2fd (ApplID), CAPI_SET_FLAGS, & flags) <0) // return CapiMsgOSResourceErr; return CapiNoError;} intcapi20ext_clr_flags (unsigned ApplID, unsigned flags) {// if (ioctl (applid2fd (ApplID), CAPI_CLR_FLAGS, & flags ) <0) // return CapiMsgOSResourceErr; return CapiNoError;} char * capi20ext_get_tty_devname (unsigned applid, unsigned ncci, char * buf, size_t size) {int unit; // unit = ioctl (applid2fd (applid), CAPI_NCCI_GETUNIT, & ncci); IF (Unit <0) RETURN 0; SNPRINTF (BUF, SIZE, "/ DEV / CAPI /% D", UNIT); RETURN BUF;} char * CAPI20EXT_GET_RAW_DEVNAME (unsigned Applid, unsigned ncci, char * buf, size_t size) { INT unit; // unit = ioctl (Applid2fd (Applid), CAPI_NCCI_GetUnit, & NCCI); IF (Unit <0) Return 0; Snprintf (buf, size, "/ dev / CAPI / R% D", Unit); Return BUF INT CAPI20EXT_NCC i_opencount (unsigned applid, unsigned ncci) {// return ioctl (applid2fd (applid), CAPI_NCCI_OPENCOUNT, & ncci); return 0;} recompiled: make the pass, then install: make install command after completion, and isdnctrl copying is ipppd / sbin directory. 3, dial-up configuration I have read some introduction articles written by others, use the examples of their writing, modify the relevant content that the phone number, user name, etc. must modify, and then run. Unfortunately, it is usually not successful. Because these examples are more perfect, it is inevitable that it is wrong with my configuration. I decided to start with simple start, only the most basic configuration, don't write a shell file, but a command to enter the execution, carefully understand its meaning, check its execution results. After all the tests are successful, write it to the shell file. It seems that this practice is very effective, I will deal with similar problems.

Echo 1> / proc / sys / net / ipv4 / ip_dynaddr Dial-Download Nettebed Internet Usage, such as I am on 163, I only know to call 163, I don't know the remote server (ie 163 dial in China Telecom) The IP address of the server) is how much, nor does it know what IP address will be assigned to my machine. Write "1" in / proc / sys / net / ipv4 / ip_dynaddr, is to tell the kernel to use dynamic IP addresses. Modprobe hisax type = 36 protocol = 2 Load the ISDN card driver. As mentioned earlier, the chip W6692 used in the Shanghai Bell SBT6021 ISDN built-in card is driven by the Hisax driver. TYPE = 36 indicates that using the W6692 chip, protocol = 2 indicates that ISDN protocol is DSS1, detailed /usr/src/linux/documentation/isdn/readme.hisax file. ISDNCTRL AddIf IPPPP0ISDN is networked by synchronization PPP, and its corresponding interface will be / dev / ippp0, / dev / ippp1, ..., etc. This command tells the kernel, join the IPPP0 interface, in other words, tell the kernel I have an ISDN device, ready to access the Internet by synchronous PPP. Since then, IPPP0 represents my ISDN device. ISDNCTRL ADDPHONE IPP0 OUT 163 Indicates the dialed phone number, I allocated 163, in mainland China, most of China Telecom's Internet is also 163. ISDNCTRL EAZ IPPP0 3382460 indicates that my own ISDN phone number is 3382460. ISDNCTRL L2_PROT IPPP0 HDLC Layer 2 protocol is HDLC. Isdnctrl L3_PROT IPPP0 TRANS Layer 3 Agreement is TRANS. ISDNCTRL ENCAP IPPP0 SyncppPPP is wrapped with synchronous PPP. Isdnctrl DialMode ipp0 manual manual dialing method, in this mode, the ISDNCTRL DIAL IPPP0 command is to hang up when dialing, and the ISDNCTRL HANGUP IPPP0 command is hung up. There is also auto automatic way, but it is still a bit more and safe with manual way. ISDNCTRL DIALMAX IPPP0 31 dialing may not connect, do not tighten, the program will be redial, and the maximum redial is 3 times. After a period of ISDNCTRL HUPTIMEOUT IPPP0 600, it will automatically hang up. The default is hanging after 10 seconds, it is too short, I changed to 600 seconds. The ISDN-specific basic configuration is so much, and below to normal network configuration. There are two main aspects of Linux's ordinary network configuration: (1) Configuration of each interface itself. Interface refers to Ethernet cards, modem, isdn and other devices. The configuration information includes network addresses, network masks, gateways, etc., the corresponding configuration tools are the IFCONFIG program. (2) Configuration of routing tables. The routing table specifies which gateway to the data packets of each destination should use which interface, etc., the corresponding configuration tool is the Route program. Before you configure, let's take a look at the current configuration situation.

My Linux machine is on a local area, the domain name of the local area network is Thalia.com, the address is 210.96.100.0, the host of this machine is GATE, the address is 210.96.100.10. Seeing the interface configuration: ifconfig gets the following information: Eth0 Link Encap: Ethernet Hwaddr 00:20: AF: F1: 0A: 4A inet addr: 2555.255 mask: 255.255.255.0inet6 AddR: Fe80 :: 220: AFFF: Fef1: A4A / 10 SCOPE: LINKINET6 AddR: Fe80 :: 20: Aff1: A4A / 10 Scope: Linkup Broadcast Running Multicast MTU: 1500 Metric: 1RX Packets: 14 Errors: 0 Dropped: 0 overruns: 0 Frame: 0TX Packets: 34 Errors: 0 Dropped: 0 CollRuns: 0 TXQUELEN: 100 Interrupt: 10 Base Address: 0x6000 Lo Link Encap: Local Loopback Inet Addr::::::: 1/128 Scope: Hostup loopback Running MTU: 3924 Metric: 1RX Packets: 38 Errors: 0 Dropped: 0 Overruns: 0 Frame: 0TX Packets: 38 Errors: 0 Dropped: 0 overruns: 0 carrier: 0Collisions: 0 TXQUEELEN: 0 2 Interface, Eth0 represents the Ethernet card, and LO is a "virtual" loopback device. Look at the routing table configuration: Route gets the following information: Kernel IP Routing TableDestination Gateway Genmask Flags Metric Ref Usenessgate.thalia.com * 255.255.255.255 UH 0 0 0 Eth0210.96.100.0 * 255.255.255.0 U 0 0 0 Eth0127. 0.0.0 * 255.0.0.0 U 0 0 0 LO has 3 routing information. To use ISDN (IPPP0), IPPP0 must be configured with IFConfig and add 1 route to use it with Route. Configure IPPP0: ifconfig ippp0 0.0.0.0 PointOPoint 0.0.0.0 NetMask 0.0.0.0 Indicates that using the PPP (Pointopoint) protocol, Pointopoint is the native address, followed by the remote server address, here is 0.0.0.0, line? Because of the previous configuration Echo 1> / proc / sys / net / ipv4 / ip_dynaddr, tell the kernel to use the dynamic IP address, so it is not a case here, it doesn't matter, when this PPP connection is established, it will Automatically replace these 0.0.0.0 with a real IP address.

That then use ifconfig to look at the situation: ifconfig gets the following information: Eth0 Link Encap: Ethernet Hwaddr 00:20: AF: F1: 0A: 4A inet Addr: 210.96.100.10 Bcast: 210.96.100.255 Mask: 255.255.255.0 INET6 AddR: Fe80 :: 220: AFF: Fef1: A4A / 10 Scope: Linkinet6 Addr: Fe80 :: 20: Aff1: A4A / 10 Scope: Linkup Broadcast Running Multicast MTU: 1500 Metric: 1Rx Packets: 64 Errors: 0 Dropped: 0 overruns: 0 frame: 0TX packets: 38 errors: 0 dropped: 0 overruns: 0 carrier: 0collisions: 0 txqueuelen: 100 Interrupt: 10 Base address: 0x6000 ippp0 Link encap: Point-to-Point Protocol UP pOINTOPOINT RUNNING nOARP MTU: 1500 Metric: 0 Dropped: 0 Overruns: 0 Frame: 0TX Packets: 0 Errors: 0 Dropped: 0 Overruns: 0 Carrier: 0Collisions: 0 TXQUEUELEN: 30 LO LINK ENCAP: LOCAL LOOPBACK INET Addr: 127.0. 0.1 Mask: 255.0.0.0.0INET6 AddR: :: 1/128 Scope: Hostup loopback Running MTU: 3924 Metric: 1Rx Packets: 44 Errors: 0 Dropped: 0 Overruns: 0 Frame: 0TX Packets: 44 Errors: 0 Dropped: 0 overruns : 0 Carrier: 0Collisions: 0 TXQuelelen: 0 more ippp0 interface, but because no real connection has not been established, its native address and remote server address are not given. Add 1 Routing: Route Add Default IPPP0 This specifies that the default (default) is transmitted through IPPP0. By default packet? What do you mean? Just now I have three routing information, this information specifies how to go to 3 destination (Destination), other packets do not specify how to go (here, in addition to which 3 data All packets outside the package), that is, for the default packet, such as packets to 168.160.24.103 (Sina.com Sina.com.cn), are default packets. So this command did this: If I want to watch the news on Sina.com, I have to pass IPPP0 (ISDN), which is what I hope. At this time, look at the situation in Route: Route gets the following information: kernel ip routing TableDestination Gateway genmask flags metric ref USE Ifacegate.thalia.com * 255.255.255.255 uh 0 0 e 0210.96.100.0 * 255.255.255.0 U 0 0 0 Eth0127.0.0.0 * 255.0.0.0 U 0 0 0 LodeFault * 0.0.0.0 U 0 0 0 ippp0 more 1 DEFAULT routing information. Note that its corresponding GATEWAY is "*".

There is a background service program ipppd to be used for ISDN PPP services: ipppd user zzh noipdefault ipcp-accept-local ipcp-accept-recote defaultroute MRU 1500 MTU 1500 / dev / ippp0 & front USER ZZH specifies the user name ZZH, password? ? Most 163 Dial-Used authentication methods are PAP authentication, user name, password information is placed in / etc / ppp / pap-secrets file, my username is ZZH, password is 51888 ("I want to send hair", Letter, Ha), so modify the / etc / ppp / pap-secrets files as follows: # secrets for authentication using PAP # Client Server Secret IP Addresseszzh * 51888 Rear NoIpDefault IPCP-Accept-local ipcp-accept-recapt-local ipcp-accept-recote indicates This is the meaning of dynamic IP addresses accepted by the remote dialing server. DEFAULTROUTE indicates that when the connection is established, it is critical to increase the Default routing entry. The MRU 1500 MTU 1500 specifies that the maximum transmitting unit and the maximum receiving unit are 1500 bytes. This program provides services for / dev / ippp0. 4, test is good, are ready, try it.

Dial - ISDNCTRL DIAL IPPP0 Look at what happens: ifconfig gets the following information: Eth0 Link Encap: Ethernet Hwaddr 00:20: AF: F1: 0A: 4A inet Addr: 210.96.100.10 Bcast: 210.96.100.255 Mask: 255.255 . 255.0 :: 220: AFFF: Fef1: A4A / 10 Scope: Linkinet6 Addr: Fe80 :: 20: Aff1: A4A / 10 Scope: Linkup Broadcast Running Multicast MTU: 1500 Metric: 1RX Packets: 29 Errors: 0 dropped: 0 overruns: 0 frame: 0TX packets: 36 errors: 0 dropped: 0 overruns: 0 carrier: 0collisions: 0 txqueuelen: 100 Interrupt: 10 Base address: 0x6000 ippp0 Link encap: Point-to-Point Protocol inet addr: 61.142 .84.71 PtP: 202.105.161.206 Mask: 255.0.0.0UP pOINTOPOINT RUNNING nOARP MTU: 1500 Metric: 1RX packets: 22 errors: 0 dropped: 0 overruns: 0 frame: 0TX packets: 21 errors: 0 dropped: 0 overruns: 0 carrier : 0Collisions: 0 TxQuelen: 30 Lo Link Encap: local loopback inet addr: 127.0.1 mask: 255.0.0.0.1 mask: 255.0.0.0.0.1 mask: 255.0.0.0.0.1 mask: 3924 metric: 1RX Packets: 43 errors: 0 Dropped : 0 Overruns: 0 Frame: 0TX Packets: 43 Errors: 0 Dropped: 0 overruns: 0 Carrier: 0Collisions: 0 TXQUEUELELEL EN: 0IPPP0 This unit address (INET ADDR) is 61.142.84.71, the PPP remote server address (P-T-P) is 202.105.161.206, instead of the original designated 0.0.0.0, indicating that the dynamic IP address works. route to get information like this: Kernel IP routing tableDestination Gateway Genmask Flags Metric Ref Use Ifacegate.thalia.com * 255.255.255.255 UH 0 0 0 eth0210.96.100.0 * 255.255.255.0 U 0 0 0 eth0127.0.0.0 * 255.0 .0.0.0.0 0 0 02.0.0.0 * 255.0.0.0.0 U 0 0 0 ippp0default 202.105.161.206 0.0.0.0 UG 0 0 0 ippp0default corresponding to Gateway is 202.105.161.206, instead of the original "*", then clear Point, it is exactly the remote server address of IPPP0.

转载请注明原文地址:https://www.9cbs.com/read-2518.html

New Post(0)