<PAGE>
                                                                    Exhibit 10.1

                                 AMENDMENT NO. 4
                                    TO LEASE



     THIS AMENDMENT NO. 4 ("Amendment") is made and entered into this 14th day
of October, 2004, by and between WESTPORT JOINT VENTURE, a California joint
venture, as LANDLORD, and COSINE COMMUNICATIONS, INC., A DELAWARE CORPORATION,
as TENANT.

                                    RECITALS

     A.   WHEREAS, by Lease Agreement dated May 26, 1998 Landlord leased to
Tenant all of that certain 48,384+ square foot building located at 1200 Bridge
Parkway, Redwood City, California, the details of which are more particularly
set forth in said May 26, 1998 Lease Agreement, and

     B.   WHEREAS, said Lease was amended by the Commencement Letter dated
August 17, 1998 which confirmed the August 1, 1998 Lease Commencement Date and
the July 31, 2010 Lease Termination Date, and,

     C.   WHEREAS, said Lease was amended by Amendment No. 1 dated September 9,
1999, which amended the Lease by (i) extending the Term for one year and five
months, changing the Termination Date from July 31, 2010 to December 31, 2011,
(ii) amending the Basic Rent schedule and Aggregate Rent accordingly, (iii)
increasing the Security Deposit required under the Lease, (iv) amending Lease
Paragraph 12 ("Taxes"), and (v) adding paragraphs ("Co-Terminous") and ("Cross
Default") to said Lease Agreement as related to additional premises leased by
Tenant at 3200 Bridge Parkway, Redwood City, California, and

     D.   WHEREAS, said Lease was amended by Amendment No. 2 dated March 28,
2000, which amended the Lease by amending Paragraph 5 to Amendment No. 1 ("Cross
Default") to include reference to additional premises leased by Tenant at 1400
Bridge Parkway, Suite 202, Redwood City, California,

     E.   WHEREAS, said Lease was amended by Letter Agreement dated June 27,
2000, whereby Landlord acknowledged Tenant's change in State of incorporation
from California to Delaware, and

     F.   WHEREAS, said Lease was amended by Amendment No. 3 dated December 20,
2002, which amended the Lease by (i) providing for Tenant to lease any
additional space required through February 29, 2012 from Landlord or one of
Landlord's affiliates and (ii) deleting Paragraph 5 of Lease Amendment No. 1
("Lease Terms Co-Terminous") and the second (incorrectly numbered) Paragraph 5
of Amendment No. 1 ("Cross Default") as amended by Paragraph 1 of Lease
Amendment No. 2 (said Lease Agreement, Commencement Letter, Amendment No. 1,
Amendment No. 2, Letter Agreement and Amendment No. 3 are hereinafter
collectively referred to as the "Lease"), and

     G.   WHEREAS, it is now the desire of the parties hereto to amend the Lease
by (i) terminating said Lease prior to the scheduled Termination Date, which
would change the Lease Termination Date from December 31, 2011 to December 31,
2004 ("Early Termination"), (ii) establishing a Termination Fee for the Early
Termination of the Lease, (iii) providing for Tenant to reimburse Landlord for
Landlord's out of pocket legal costs related to the Early Termination, (iv)
amending the Basic Rent schedule and Aggregate Basic Rent of the Lease due to
the Early Termination, (v) providing for Tenant to transfer ownership of certain
Furniture within the Premises to Landlord, and (vi) confirming Tenant's
obligations to lease any future additional space required within the Silicon
Valley from Landlord or an affiliate of Landlord as hereinafter set forth.
<PAGE>
                                    AGREEMENT

     NOW THEREFORE, for valuable consideration, receipt of which is hereby
acknowledged, and in consideration of the hereinafter mutual promises, the
parties hereto do agree as follows:

     1.   TERMINATION OF LEASE: As an accommodation to Tenant and subject to the
terms and conditions stated herein, Landlord has agreed to the Early Termination
of the Lease; therefore, the Lease Termination Date shall be changed from
December 31, 2011 to December 31, 2004 ("Early Termination Date"). Tenant shall
be responsible for paying all Basic Rent and Additional Rent and fulfilling all
Lease obligations as contained in said Lease through the Early Termination Date
except as otherwise provided herein. Notwithstanding the above, Tenant's
obligations as stated in Lease Paragraphs 12 ("Taxes"), 16 ("Indemnification"),
17 ("Compliance") and 53 ("Hazardous Materials") shall survive the termination
of the Lease; it being understood, however, that Tenant's obligations under the
aforementioned Paragraphs 12, 17 and 53 shall survive only as to those
obligations that accrued and/or occurred during the term of the Lease.

     Although the foregoing agreement regarding termination shall be deemed
effective upon execution of this Amendment No. 4 by both parties, and Landlord
shall be entitled to take possession of the Premises in accordance with the
terms of this Amendment No. 4 upon Tenant's surrender of the Premises (such to
occur not later than the early Termination Date) and relet them for its own
account, the release of Tenant from its obligations under the Lease as stated in
Lease Paragraph 4 ("Rent"), including but not limited to the obligation to pay
all Rent and other sums due thereunder, shall not be deemed effective unless and
until ninety-one (91) days have expired from the date the Termination Fee is
paid to Landlord and the funds for such payment have cleared Tenant's bank
account and/or the issuing bank and a bankruptcy or insolvency proceeding has
not been filed by or against Tenant. In the event a bankruptcy or insolvency
proceeding is filed within said ninety-one (91) day period, the release of
Tenant from its future obligations under the Lease shall not be effective and
Landlord shall be entitled to recover damages from Tenant in accordance with
Section 1951.2 of the California Civil Code and the default provisions of
Paragraph 22 of the Lease for all Rent and other sums due under the Lease
through the originally scheduled Lease Termination Date of December 31, 2011. In
such event, Landlord shall be entitled to retain the Termination Fee and to
offset the amount of the Termination Fee against all damages recoverable to the
extent permissible under applicable law. In consideration of the Landlord's
execution of this Amendment, Tenant waives the provisions of Section 1950.7 of
the California Civil Code, and any claim concerning the security deposit to be
retained by Landlord and or amounts paid to Landlord pursuant to this Amendment.

          A.   SURRENDER OBLIGATIONS: Subject to the terms and conditions
herein, Tenant shall be responsible for relinquishing the Premises in the
condition required under Lease Paragraphs 8 ("Acceptance and Surrender of
Premises"), 9 ("Alterations and Additions") and 53 ("Hazardous Materials");
provided, however, that Tenant's payment for the Restoration Work (as defined
below) in the manner provided immediately below shall constitute satisfaction of
its obligations under Paragraphs 8 and 9. Prior to the execution of this
Amendment, Landlord and Tenant shall conduct a joint inspection of the Premises
to determine the extent of the work required by Tenant to comply with the
provisions of said Paragraphs 8 and 9 ("Restoration Work"). In lieu of Tenant
completing the required Restoration Work and pursuant to the terms herein, the
parties hereto agree that Tenant shall pay Landlord for the estimated cost of
the Restoration Work based on estimates received from Landlord's contractors.
The Termination Fee referenced in Paragraph 2 ("Termination Fee") includes a
Restoration Allowance (as defined in said Paragraph 2) of $100,000 , which sum
represents Tenant's entire liability for completion of the Restoration Work.
Tenant understands and acknowledges that Tenant will not receive a refund or
credit on any portion of the Restoration Allowance that may exceed the estimated
costs for the Restoration Work. For Example: if the estimated costs for the
Restoration Work is $95,000.00 ($5,000.00 less than the Restoration Allowance),
Tenant would not be entitled to receive a credit or refund.
<PAGE>

     Tenant shall be required to surrender the Premises no later than the Early
Termination Date in broom clean condition and free of all personal property
belonging to Tenant (except for the Personal Property to be transferred to
Landlord pursuant to Paragraph 3 ("Tenant's Personal Property to be Transferred
to Landlord") below); however, Tenant shall be liable for any damage to the
Premises that occurs from the date of this Amendment to the Early Termination
Date (or any earlier date of surrender) caused by Tenant or its employees,
agents, contractors or guests, to the extent such damage increases the cost of
repair and restoration of the Premises above the amount of the Restoration
Allowance.

          B.   TAXES. Tenant's ongoing obligation related to Paragraph 12
("Taxes") shall include all regularly assessed Real Estate Taxes and any
supplemental taxes related to the period of Tenant's Lease Term whenever levied,
including any such taxes that may be levied after the Early Termination Date but
accrue to the period before the Early Termination Date.

          C.   HAZARDOUS MATERIALS. In the event any Hazardous Materials were
used and/or stored on the Premises during the Term of the Lease by Tenant,
Tenant's assignor (if any) or subtenants (if any), prior to the Early
Termination Date, Tenant shall provide Landlord, concurrently with the return of
this executed Amendment No. 4, with (i) a list of Hazardous Materials used
and/or stored on the Premises, including the quantities so used and/or stored,
(ii) copies of all Hazardous Materials permits, (iii) copies of all related
Hazardous Materials manifests, (iv) a copy of the floor and site plan of the
Premises reflecting the location where any and all Hazardous Materials were
used, stored and/or disposed, and (v) a copy of the preliminary and final
Hazardous Materials Closure Plan filed with the City of Redwood City. IF NO
HAZARDOUS MATERIALS WERE USED AND/OR STORED ON THE PREMISES, TENANT SHALL
PROVIDE LANDLORD WITH A WRITTEN STATEMENT REPRESENTING AND WARRANTING THE SAME.

     2.   TERMINATION FEE: As a material part of the consideration for
Landlord's consent to the Early Termination of this Lease, Tenant agrees to pay
to Landlord $4,551,587.20 ("Termination Fee"). The Termination Fee includes a
non-refundable allowance of $100,000 towards Tenant's surrender obligations
("Restoration Allowance") as set forth in Paragraph 1.A ("Termination of Lease:
Surrender Obligations"). Landlord shall retain Tenant's full Security Deposit of
$420,940.80 as partial payment to be applied to the Termination Fee, and, upon
Tenant's execution of this Amendment No. 4, Tenant shall pay to Landlord the
remaining balance of $4,130,646.40 in the form of a wire transfer to Landlord's
bank pursuant to wire instructions to be provided to Tenant. Said Termination
Fee must be received by Landlord's bank no later than 5:30 p.m. DST on Friday,
October 22, 2004.

     3.   Tenant's Personal Property to be Transferred to Landlord. As a
material part of the consideration for Landlord's consent to the Early
Termination of the Lease, Tenant hereby assigns, at no cost to Landlord, its
ownership interest in all of the office furniture/cubicles and equipment listed
on Exhibit A attached hereto (collectively "Furniture") as of date this
Amendment is last executed by the parties hereto, and Tenant agrees to
concurrently execute the Bill of Sale attached hereto as Exhibit B for the same.
Tenant further warrants and represents to Landlord that the Furniture is owned
free and clear of any debt by Tenant, there are no existing or pending liens
against said Furniture and that the Furniture has not been and shall not be
encumbered by Tenant. The Furniture, as of the Early Termination Date (or such
earlier date that Tenant surrenders the Premises to Landlord) , shall become the
property of the Landlord. The Furniture shall be delivered to Landlord in its
current, "as is" condition, except as noted herein, without any warranty or
guaranty of any kind or nature (express or implied) concerning the quality,
condition or value of the Furniture, or its usefulness for any particular
purpose. The parties agree that Landlord shall have the right to remove the
items referenced in bold lettering on the attached Exhibit A prior to the Early
Termination Date. Landlord shall coordinate the removal of said items with
Tenant. Tenant shall leave the remaining Furniture listed on said Exhibit A in
the Premises upon the termination of the Lease. It is understood that Tenant
shall have no liability or responsibility for any damage to the Furniture
occurring after the date this Amendment is executed except for any damage caused
by Tenant's willful misconduct.


<PAGE>

     4.   LEGAL FEES: As a material part of the consideration for Landlord's
agreement to amend the Lease pursuant to the terms and conditions herein, Tenant
agrees to pay to Landlord Landlord's actual out of pocket legal costs related to
the preparation of this Amendment (the "Legal Fees"). The maximum cost to be
incurred by Tenant for said Legal Fees is $5,000.00. Tenant agrees to pay said
Legal Fees to Landlord within ten (10) days of receipt of an invoice from
Landlord with appropriate supporting documentation.

     5.   REAL PROPERTY INSURANCE: Notwithstanding Tenant's obligations related
to payment of Additional Rent as set forth in Paragraph 1 ("Termination of
Lease") above, Tenant acknowledges that Tenant has prepaid real property
insurance premiums due through March 13, 2005, and that Tenant will not receive
any rebate of said prepaid premiums related to the Premises accruing after the
Early Termination Date of December 31, 2004.

     6.   BASIC RENT: For the period of November 1, 2004 through December 31,
2004, no Basic Rent will be due; however, Tenant will be responsible for all
Additional Rent through the Early Termination Date as set forth in the Lease.

     Pursuant to this Early Termination, the Aggregate Basic Rent for the Lease
shall be decreased by $16,576,358.40 (i.e. from $27,274,060.80 to
$10,697,702.40).

     7.   FUTURE LEASE COMMITMENT: The parties hereto acknowledge and agree that
pursuant to Paragraph 1 of Amendment No. 3 ("Future Lease Commitment"), Tenant
agreed that if Tenant determines at any time from the date of said Amendment No.
3 (December 20, 2002) through February 29, 2012 that it wishes to lease
additional space within the Silicon Valley (i.e. Palo Alto, Mountain View,
Redwood City, Fremont, Sunnyvale, Santa Clara, San Jose and/or Milpitas), it
will give Landlord notice (the "Rental Notice") and an opportunity to lease such
space to Tenant (in a building owned by Landlord or an affiliate of Landlord),
subject to and in accordance with the terms of Paragraph 1 of Amendment No. 3
("Future Lease Commitment"), provided that the space Landlord (or its affiliate)
makes available is within the Silicon Valley. The obligations of Tenant under
said Paragraph 1 of Amendment No. 3 ("Future Lease Commitment") shall survive
the termination of the Lease.

     8.   AUTHORITY TO EXECUTE. The parties executing this Amendment hereby
warrant and represent that they are properly authorized to execute this
Amendment and bind the parties on behalf of whom they execute this Amendment and
to all of the terms, covenants and conditions of this Amendment as they relate
to the respective parties hereto.

     9.   CHOICE OF LAW/VENUE; SEVERABILITY. This Amendment shall in all
respects be governed by and construed in accordance with the laws of the County
of Santa Clara in the State of California and each party specifically stipulates
to venue in Santa Clara County. If any provisions of this Amendment shall be
invalid, unenforceable, or ineffective for any reason whatsoever, all other
provisions hereof shall be and remain in full force and effect.

     10.  EXAMINATION OF AMENDMENT: This Amendment No. 4 shall not be effective
until its execution by both Landlord and Tenant. NOTWITHSTANDING ANYTHING TO THE
CONTRARY HEREIN, LANDLORD'S AGREEMENT TO AMEND THE LEASE IS CONTINGENT UPON
TENANT EXECUTING AND RETURNING THIS AMENDMENT TO LANDLORD NO LATER THAN 5:30
P.M. PDT ON FRIDAY, OCTOBER 22, 2004. IN THE EVENT LANDLORD HAS NOT RECEIVED THE
EXECUTED AMENDMENT BY SUCH TIME, THIS AMENDMENT MAY, AT LANDLORD'S OPTION, BE
NULL AND VOID AND OF NO FURTHER FORCE OR EFFECT AND SAID LEASE SHALL CONTINUE IN
FULL FORCE AND EFFECT ABSENT THIS PENDING AMENDMENT NO. 4.

     EXCEPT AS MODIFIED HEREIN, all other terms, covenants, and conditions of
the Lease shall remain in full force and effect.


                                        |
                                        |
                                        |
                                        |
                                        |
                      (This Space Left Blank Intentionally)
                                        |
                                        |
                                        |
                                        |


<PAGE>

     IN WITNESS WHEREOF, Landlord and Tenant have executed this Amendment No. 4
to Lease as of the day and year last written below.


LANDLORD:                               TENANT:

WESTPORT JOINT VENTURE                  COSINE COMMUNICATIONS, INC.
A California joint venture              a Delaware corporation


JOHN ARRILLAGA SURVIVOR'S TRUST         By: /s/ Terry Gibson
                                            -------------------------------

By: /s/ John Arrillaga                      EVP & CFO
    ---------------------------             -------------------------------
John Arrillaga, Trustee                     Print or Type Name/Title

Date: 10/22/04                              Date: 10/22/04
      -------------------------                   -------------------------

PEERY PRIVATE INVESTMENT
COMPANY-WP, L.P.,
A California limited partnership

By: /s/ Richard T. Peery
    -------------------------------
Richard T. Peery, Trustee of the
Richard T. Peery Separate Property
Trust dated 7/20/77, as its General
Partner

Date: 10/22/04
      -----------------------------


PEERY PUBLIC INVESTMENT
COMPANY-WP, L.P.,
A California limited partnership


By: /s/ Richard T. Peery
    -------------------------------
Richard T. Peery, Trustee of the
Richard T. Peery Separate Property
Trust dated 7/20/77, as its General
Partner

Date: 10/22/04
      -----------------------------