{"id":169,"date":"2009-09-16T21:32:54","date_gmt":"2009-09-16T20:32:54","guid":{"rendered":"http:\/\/simkin.org\/wordpress\/?p=169"},"modified":"2010-12-14T23:14:45","modified_gmt":"2010-12-14T22:14:45","slug":"sipgate-cisco-1701-router-and-cisco-7940","status":"publish","type":"post","link":"http:\/\/simkin.org\/wordpress\/?p=169","title":{"rendered":"Sipgate, Cisco 1701 router and Cisco 7940"},"content":{"rendered":"<p>Regular readers or those with the power of search will know I managed to connect a Cisco 7940 to Sipgate. Those who know me in person will know that I changed my router\/firewall combination out for a Cisco 1701 and it all stopped working on the Sipgate front.<\/p>\n<p>In short, My Cisco was telling me it was connecting and registered.<\/p>\n<p style=\"padding-left: 30px;\">SIP Phone&gt; sh reg<\/p>\n<p>LINE REGISTRATION TABLE<br \/>\nProxy Registration: ENABLED, state: REGISTERED<br \/>\nline\u00c2\u00a0 APR\u00c2\u00a0 state\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 timer\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 expires\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 proxy:port<br \/>\n&#8212;-\u00c2\u00a0 &#8212;\u00c2\u00a0 &#8212;&#8212;&#8212;&#8212;-\u00c2\u00a0 &#8212;&#8212;&#8212;-\u00c2\u00a0 &#8212;&#8212;&#8212;-\u00c2\u00a0 &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br \/>\n1\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 111\u00c2\u00a0 REGISTERED\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 3595\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 3512\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0\u00c2\u00a0 sipgate.co.uk:5060<\/p>\n<p>Outbound calling was fine as always. Inbound wasn&#8217;t working. Sipgate tech support told me I was not registering at all. Bugger.<\/p>\n<p>Turned out it was down to layer-4 NAT. The Cisco it seems does a better job of dealing with NAT than my sonicwall. The Cisco is able to deal with the NAT translation in SIP messages whilst the Sonicwall I used before didn&#8217;t. The solution was simple: turn-off NAT support on the phone.<\/p>\n<p><strong>Dumb Firewall<\/strong><\/p>\n<p>In sipdefault.cnf, you can configure the phone behind a non-SIP friendly firewall running one-to-one NAT as follows. In effect, the phone sends outbound SIP messages with the public address and leaves the firewall to NAT only the packet source address:<\/p>\n<pre>nat_address : 194.223.x.x ; put the public address here\r\n\r\nnat_received_processing : 0\r\n\r\nnat_enable : 0<\/pre>\n<p><strong>Smart Firewall<\/strong><\/p>\n<p>If you do not have a fixed one-to-one NAT on your router and your router is handling layer-4 NAT then change these lines in sipdefault.cnf:<\/p>\n<pre>nat_address : \"\" ; yes. Double quotes, no spaces\r\n\r\nnat_received_processing : 1\r\n\r\nnat_enable : 1<\/pre>\n<p><strong>Example Config<\/strong><\/p>\n<p>For your pleasure and enjoyment, please find enclosed the useful bits from my router and phone configs\u00c2\u00a0 (shown here in the version where the router doesn&#8217;t handle layer-4 SIP NAT and you need to tell the phone the fixed external IP but the router config here can be left unchanged with the phone doing or not doing NAT.)<\/p>\n<p>If you want to use these, copy-paste and make the following search-replacements:<\/p>\n<p>10.x.x.1 &#8211; your LAN gateway<br \/>\n10.x.x.2 &#8211; your tftp server<br \/>\n10.x.x.3 &#8211; your phone ip on the LAN<br \/>\ny.y.y.y the static public IP that your phone is NATted out to<br \/>\n12345 &#8211; your sipgate login<br \/>\nsipgatepassword &#8211; your erm, password for sipgate<\/p>\n<p><strong>SIPDEFAULT.CNF<\/strong><\/p>\n<p style=\"padding-left: 30px;\">;begin<br \/>\ndhcp_server : Disabled<br \/>\nmy_ip_addr : 10.x.x.3<br \/>\nsubnet_mask : 255.255.255.0<br \/>\ndefaultgw : 10.x.x.1<br \/>\ndyn_dns_addr_1 : 0.0.0.0<br \/>\ndyn_dns_addr_2 : 0.0.0.0<br \/>\ndns_addr : 208.67.220.220<br \/>\ndns_backup_1: 208.67.222.222<br \/>\nprimary_tftp_addr : 10.x.x.2<br \/>\ndyn_tftp_addr : 0.0.0.0<br \/>\ndomain_name : simkin.org<br \/>\nStatus Flags : 12300001<br \/>\nimage_version : P0S3-8-12-00<br \/>\nnetwork_media_type : Auto<br \/>\nnetwork_port2_type : Hub\/Switch<br \/>\nphone_password : password<br \/>\nphone_prompt : &#8220;SIP Phone&#8221;<br \/>\nnat_enable : 0<br \/>\nnat_address : y.y.y.y<br \/>\nvoip_control_port : 5060<br \/>\nstart_media_port : 16384<br \/>\nend_media_port : 32766<br \/>\nmessages_uri : &#8220;*97&#8221;<br \/>\npreferred_codec : g711ulaw<br \/>\nproxy1_address : &#8220;sipgate.co.uk&#8221;<br \/>\nproxy1_port : 5060<br \/>\noutbound_proxy : sipgate.co.uk<br \/>\noutbound_proxy_port : 5082<br \/>\nnat_received_processing : 0<br \/>\n;end<\/p>\n<p><strong>SIP&lt;MACADDRESS&gt;.CNF<\/strong><\/p>\n<p style=\"padding-left: 30px;\">;begin<br \/>\nphone_label : &#8220;Orange Teapot &#8221;<br \/>\nline1_name : 12345<br \/>\nline1_authname : 12345<br \/>\nline1_password : sipgatepassword<br \/>\nline1_shortname : 12345<br \/>\nline1_displayname : 12345<br \/>\nline2_displayname : &#8220;&#8221;<br \/>\nline2_shortname : &#8220;&#8221;<br \/>\nline2_name: UNPROVISIONED<br \/>\nline2_authname : UNPROVISIONED<br \/>\nline2_password : UNPROVISIONED<br \/>\n;end<\/p>\n<p><strong>Running config on router:<\/strong><\/p>\n<p style=\"padding-left: 30px;\">ip inspect max-incomplete low 350<br \/>\nip inspect max-incomplete high 400<br \/>\nip inspect one-minute high 1000<br \/>\nip inspect one-minute low 900<br \/>\nip inspect tcp max-incomplete host 100 block-time 0<br \/>\nip inspect name INSPECTOUT sip<br \/>\nip inspect name INSPECTOUT tcp<br \/>\nip inspect name INSPECTOUT udp<br \/>\n!<br \/>\ninterface FastEthernet0<br \/>\nip address 10.x.x.1 255.255.255.0<br \/>\nip accounting output-packets<br \/>\nip nbar protocol-discovery<br \/>\nip nat inside<br \/>\nload-interval 30<br \/>\nhold-queue 100 out<br \/>\n!<br \/>\ninterface ATM0.1 point-to-point<br \/>\ndescription Access to DSL Network<br \/>\nip nat outside<br \/>\n!<br \/>\ninterface Virtual-Template1<br \/>\nip address negotiated<br \/>\nip access-group ACL101 in<br \/>\nip nat outside<br \/>\nip inspect INSPECTOUT out<br \/>\nload-interval 30<br \/>\n!<br \/>\nip nat inside source static 10.x.x.3 y.y.y.y<br \/>\n!<br \/>\nip access-list extended ACL101<br \/>\npermit icmp any any echo-reply<br \/>\npermit icmp any any administratively-prohibited<br \/>\npermit icmp any any packet-too-big<br \/>\npermit icmp any any time-exceeded<br \/>\npermit icmp any any unreachable<br \/>\ndeny   icmp any any<br \/>\ndeny   tcp any any eq telnet<br \/>\npermit udp any host y.y.y.y eq 5060<br \/>\ndeny   ip any any<\/p>\n<p style=\"padding-left: 30px;\">\n<p>The &#8220;ip inspect&#8221; statements do most of the work. The inbound 5060 is possibly not needed but needs to be\u00c2\u00a0 open so no harm, no foul. I use a fixed one-to-one NAT as it is simple and I have a spare address. It should work with PAT as well but I don&#8217;t need that so have not tested for it.<\/p>\n<p>If you get problems, remember a few things:<\/p>\n<ul>\n<li>Don&#8217;t NAT in two places.<\/li>\n<li>Change the nat_received_processing and nat_enabled values first. Empty the nat_address if you have nat_enable: 1 (i.e. the phone is told that NAT is being handled elsewhere).<\/li>\n<li>Test using a softphone like Phonerlite <span style=\"text-decoration: underline;\">without<\/span> STUN to get your firewall settings right only then try to get the phone working<\/li>\n<li>The sipgate server shows you register but is only a snapshot. If registration fails or falls over later, you won&#8217;t know. Your phone &#8220;sh reg&#8221; can also be misleading as it is in effect a snapshot from the last attempt which may have been 5 minutes ago.<\/li>\n<li>Changing phone settings needs a restart. Telnet 10.x.x.3, type your password &lt;cr&gt; reset &lt;cr&gt; and go get another beer<\/li>\n<li>Registration can be dropped and re-established with &#8220;reg 01&#8221; and &#8220;reg 1 1&#8221;<\/li>\n<\/ul>\n<p>Good luck!<\/p>\n<p>For those wanting to fathom out how to run a phone behind a NAT router without giving it a fixed address, try reading here. (My thoughts are to enable NAT and give out a dyndns name rather than IP in nat_address but I have not tried it yet):<\/p>\n<p class=\"pBl_BlockLabel\">\n<pre style=\"padding-left: 30px;\"><span class=\"content\"><a name=\"wp29073\"><\/a>\r\nWhen network address translation (NAT) is enabled, the Cisco SIP IP\r\nPhone provides support for SIP messages to traverse NAT\/Firewall\r\nnetworks. The Contact and Via headers are modified to reflect the NAT\r\nparameters. The Cisco SIP IP Phone can also enable NAT received\r\nprocessing. See the nat_enable, nat_address, and nat_received_processing\r\nparameters in the section, \"Modifying the Default SIP Configuration\r\nFile\" in Chapter 3, \"Managing Cisco SIP IP Phones,\" at the following URL:\r\n<p class=\"pB1_Body1\">http:\/\/www.cisco.com\/univercd\/cc\/td\/doc\/product\/voice\/c_ipphon\/sip7960\/sipadm22\/index.htm\r\n\r\n<\/p>\r\n\r\n<\/span><\/pre>\n<p><span class=\"content\">To quote from that page:<\/span><\/p>\n<p>* <strong>nat_enable<\/strong>\u00e2\u20ac\u201d(Optional) Use 0 to disable network address translation (NAT) and 1 to enable NAT. Default is 0.<\/p>\n<p>When NAT is enabled, the Contact header appears like this:<\/p>\n<p style=\"padding-left: 30px;\">Contact: sip:lineN_name@nat_address:voip_control_port<\/p>\n<p>If nat_address is invalid or UNPROVISIONED, then the Contact header appears like this:<\/p>\n<p style=\"padding-left: 30px;\">Contact: sip:lineN_name@phone_ip_address:voip_control_port<\/p>\n<p>and the Via header appears like this:<\/p>\n<p style=\"padding-left: 30px;\">Via: SIP\/2.0\/UDP phone_ip_address:voip_control_port<\/p>\n<p>If NAT is enabled, the SDP message uses the nat_address and a RTP port between the start_media_port<br \/>\nand the end_media_port range in the C and M fields. All RTP traffic is sourced from the port advertised<br \/>\nin the SDP.<\/p>\n<p>* <strong>nat_address<\/strong>\u00e2\u20ac\u201dThe WAN IP address of the NAT or firewall server. You can use either a dotted IP address or a DNS name.<\/p>\n<p>* <strong>nat_received_processing<\/strong>\u00e2\u20ac\u201dUse 0 to disable NAT received processing and 1 to enable NAT received processing. Default is 0. If nat_received_processing is enabled, and received= tag is in the Via header of the 200 OK response from a REGISTER, the IP address in the received= tag is used instead of the nat_address in the Contact header.<\/p>\n<p>If this switch occurs, the phone unregisters the old IP address and reregisters with the new IP address.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Regular readers or those with the power of search will know I managed to connect a Cisco 7940 to Sipgate. &hellip; <a class=\"more-link\" href=\"http:\/\/simkin.org\/wordpress\/?p=169\">More<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":""},"categories":[3],"tags":[169,165,170,171,162,163],"jetpack_featured_media_url":"","_links":{"self":[{"href":"http:\/\/simkin.org\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/169"}],"collection":[{"href":"http:\/\/simkin.org\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/simkin.org\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/simkin.org\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/simkin.org\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=169"}],"version-history":[{"count":0,"href":"http:\/\/simkin.org\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/169\/revisions"}],"wp:attachment":[{"href":"http:\/\/simkin.org\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=169"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/simkin.org\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=169"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/simkin.org\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=169"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}