Thursday, March 21, 2013

L2TP with MPPE


For my understanding L2TP usually use IPsec for security, but today I tested a cpe router which has a L2TP client which use MPPE. I was puzzled but then I figured out that CISCO ios support L2TP with MPPE. You just need to add the line "ppp encrypt mppe auto" to the virtual template,

---------------------------------------------------------------------
vpdn-group L2TP-pure
 accept-dialin
  protocol l2tp
  virtual-template 52

interface Virtual-Template52
 ip unnumbered Loopback1
 ip nat inside
 ip virtual-reassembly
 peer default ip address pool L2TP-POOL
ppp encrypt mppe auto

ip local pool L2TP-POOL 192.168.60.10 192.168.60.100
---------------------------------------------------------------------


Tuesday, February 21, 2012

IPv6 TFTPD and TOD servers

To enable IPv6 support for xinetd TFTP and TOD server, just add the bind statement in to the configuration file,

------------ TFTP -------------------------


service tftp
{
protocol = udp
port = 69
socket_type = dgram
wait = yes
user = nobody
server = /usr/sbin/in.tftpd
server_args = /tftpboot
disable = no
bind = 2001:0:130:1::24
}


------- TOD --------------------------

service time
{
disable = no
type = INTERNAL
id = time-dgram
socket_type = dgram
protocol = udp
user = root
wait = yes
bind = 2001:0:130:1::24
}

DOCSIS and eRouter ISC DHCPv6 server configuration

After googling around a lot I managed to configure my ISC DHCP server to provision a DOCSIS modem and eRouter in IPv6. Given below is how I configured the DHCPv6 options in the ISC DHCPD config file (dhcp6.conf),

---------- Cable modem DHCP options ---------------
option space docsis code width 2 length width 2 hash size 17;
option docsis.tftp-server code 32 = array of ip6-address;
option docsis.cablelabs-configuration-file code 33 = text;
option docsis.cablelabs-syslog-servers code 34 = array of ip6-address;
option docsis.device-id code 36 = string;
option docsis.time-servers code 37 = array of ip6-address;
option docsis.time-offset code 38 = signed integer 32;
option vsio.docsis code 4491 = encapsulate docsis;


shared-network CM {
default-lease-time 600;
max-lease-time 7200;
log-facility local7;
subnet6 2001:0:140:1::/64 {
range6 2001:0:140:1::50 2001:0:140:1::254;
option dhcp6.name-servers 2001:0:130:1::23;
option docsis.tftp-server 2001:0:130:1::24;
option docsis.cablelabs-configuration-file "basic.cfg";
option docsis.cablelabs-syslog-servers 2001:0:130:1::23;
option docsis.time-servers 2001:0:130:1::24;
option docsis.time-offset 28800;
}
}

---------------------------------------------------------


----------- CPE ( eRouter ) DHCP options -----------------

shared-network CPE {
default-lease-time 600;
max-lease-time 7200;
log-facility local7;
subnet6 2001:0:f140:1::/64 {
range6 2001:0:f140:1::50 2001:0:f140:1::254;
option dhcp6.name-servers 2001:0:130:1::23;
prefix6 2001:0:150:: 2001:0:150:: /64;
}
}

-----------------------------------------------------------

Saturday, January 1, 2011

Two's complement to Decimal in JAVA

I was searching for a way to convert two's complement to Decimal in JAVA , it seems like there is no built-in method to do this. So I wrote a code , probably this is not the most efficient way to do it , but you can use it if u are desperate and have no time to write your own version.



//----------------JAVA code-------------------------------------
package de.vogella.android.locationapi.maps;

public class TwosToInt {

private static int[] latIntArrayNew = new int[32];
private static String[] latStringArray = new String[32];
private static int latDec;
private static String latStringString;
/**
* @param args
*/
public static String twostoint(int[] latIntArray) {
int kk = latIntArray[0];
if(kk==1){
//---convert-----------
for(int i=0;i<32;i++){

//--- binary NO operation
if(latIntArray[i]==0){latIntArrayNew[i]=1;}
else{latIntArrayNew[i]=0;}

}
}else{

latIntArrayNew = latIntArray;
}

for(int j=0;j<32;j++){latStringArray[j] = Integer.toString(latIntArrayNew[j]);}

latStringString = arrayToString2(latStringArray);

//--add 1 after the NO operation
latDec = 0;
if(kk==1){
latDec = (( Integer.parseInt(latStringString,2))+1)*(-1);
}else{
latDec = ( Integer.parseInt(latStringString,2)+1);
}

return Integer.toString(latDec);
//Integer.toString(latDec);
//latStringString;



}

public static String arrayToString2(String[] a) {
StringBuffer result = new StringBuffer();
if (a.length > 0) {
for (int i=0; i result.append(a[i]);
}
}

return result.toString();
}


}

Tuesday, May 11, 2010

Statically creating a UGS flow (DOCSIS)

I have been trying to define a UGS flow in the Cable modem config file because this particular eMTA I was testing does not support Dynamic service flow creation ( DQOS) for Voice traffic. When I just change the "SchedulingType" to "6" the modem gets a registration reject from the CMTS .

the examples below can be used to define a UGS flow statically using the CM config file , I am using a Best effort service flow for Downstream,

-----------------------

UsServiceFlow /*voice service flow*/
{
UsServiceFlowRef 5;
QosParamSetType 7;
SchedulingType 6;
RequestOrTxPolicy 0x0000001f;
UnsolicitedGrantSize 500;
NominalGrantInterval 10000;
ToleratedGrantJitter 2000;
GrantsPerInterval 1;
}


-----------------------

Thursday, March 18, 2010

run a LOOP in windows Batch file

I have been searching for a way to run a simple loop to repeat a windows batch file , many website give some general commands but no examples , I found this one which exactly does what I wanted. Copy and paste this in a text file and save it with the extention xxx.bat and double click it or go to dos prompt, change the path to where the file is and type test.bat, example D:\> test.bat

-------------------

:Loop


ping 127.0.0.1 /*this is the file I want to run repeatedly */


goto Loop

----------------------


Monday, January 11, 2010

Terayon BW3240

I have been working on configuring a Terayon BW3240 CMTS . Did not receive any documentation or console cable with the units. the major problem was accessing the console , the console port is RJ11 ,so I googled for R11 to RS232 pin out but could not find a standard pin definition . Finally I found some documents for TeryonBW3500 CMTS with RJ11 to RS232 connection diagram but the connector which was described in that was a RJ12 with 6 pins and the BW3240 only has RJ11 (4 pin) connector on it. Finally with some help , using a oscilloscope I managed to find which pin was Tx and which was Rx , the pin out is given below